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
8d34496986e68de8aa1a691a494da08f523cb034
oauthenticator/tests/conftest.py
oauthenticator/tests/conftest.py
"""Py.Test fixtures""" from tornado.httpclient import AsyncHTTPClient from pytest import fixture from .mocks import MockAsyncHTTPClient @fixture def client(io_loop, request): """Return mocked AsyncHTTPClient""" before = AsyncHTTPClient.configured_class() AsyncHTTPClient.configure(MockAsyncHTTPClient) ...
"""Py.Test fixtures""" from tornado.httpclient import AsyncHTTPClient from tornado import ioloop from pytest import fixture from .mocks import MockAsyncHTTPClient @fixture def io_loop(request): """Same as pytest-tornado.io_loop, adapted for tornado 5""" io_loop = ioloop.IOLoop() io_loop.make_current() ...
Add ioloop fixture that works with tornado 5
Add ioloop fixture that works with tornado 5
Python
bsd-3-clause
maltevogl/oauthenticator,minrk/oauthenticator,NickolausDS/oauthenticator,jupyterhub/oauthenticator,jupyter/oauthenticator,jupyter/oauthenticator,enolfc/oauthenticator
12f1024d559c300c7c04256362da78ec8d3a647b
data/models.py
data/models.py
from django.db import models class DataPoint(models.Model): name = models.CharField(max_length=600) exact_name = models.CharField(max_length=1000, null=True, blank=True) decay_feature = models.CharField(max_length=1000, null=True, blank=True) options = models.CharField(max_length=100) homo = mode...
import numpy import ast from django.db import models class DataPoint(models.Model): name = models.CharField(max_length=600) exact_name = models.CharField(max_length=1000, null=True, blank=True) decay_feature = models.CharField(max_length=1000, null=True, blank=True) options = models.CharField(max_le...
Add method on DataPoint to get numpy matrices with all the ML data
Add method on DataPoint to get numpy matrices with all the ML data
Python
mit
crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp
83e83cdd90364e037530974e2cea977a05ac449b
pos_picking_state_fix/models/pos_picking.py
pos_picking_state_fix/models/pos_picking.py
# -*- coding: utf-8 -*- # See README file for full copyright and licensing details. import time from openerp import models, api from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT class PosPicking(models.Model): _inherit = 'pos.order' @api.multi def create_picking(self): try: su...
# -*- coding: utf-8 -*- # See README file for full copyright and licensing details. import time from openerp import models, api from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT class PosPicking(models.Model): _inherit = 'pos.order' @api.multi def create_picking(self): try: su...
Move code outside of exception
[FIX] Move code outside of exception
Python
agpl-3.0
rgbconsulting/rgb-pos,rgbconsulting/rgb-addons,rgbconsulting/rgb-pos,rgbconsulting/rgb-addons
6807e5a5966f1f37f69a54e255a9981918cc8fb6
tests/test_cmd.py
tests/test_cmd.py
import base64 import os from distutils.core import Command class TestCommand(Command): description = "Launch all tests under fusion_tables app" user_options = [] def initialize_options(self): pass def finalize_options(self): pass def create_client_secret_file(self): clie...
import base64 import os from distutils.core import Command class TestCommand(Command): description = "Launch all tests under fusion_tables app" user_options = [] def initialize_options(self): pass def finalize_options(self): pass def create_client_secret_file(self): clie...
Fix unit test python3 compatibility.
Fix unit test python3 compatibility.
Python
mit
bsvetchine/django-fusion-tables
1f50f159de11a6ff48ce9ce1a502e990228f8dc0
builtin_fns.py
builtin_fns.py
import object as obj import ast from evaluator import NULL, TRUE, FALSE class Builtin(object): builtins = [] """a builtin function""" def __init__(self, pattern, fn): self.pattern = pattern # e.g. ["print", "$obj"] self.fn = fn # fn(args) where args is a dictionary ...
import object as obj import ast from evaluator import NULL, TRUE, FALSE class Builtin(object): builtins = [] """a builtin function""" def __init__(self, pattern, fn): self.pattern = pattern # e.g. ["print", "$obj"] self.fn = fn # fn(args) where args is a dictionary ...
Add a few more builtins
Add a few more builtins - print $obj without newline - input - input with prompt $prompt
Python
mit
Zac-Garby/pluto-lang
fc66db188ecabbe21cea23c91a9e9b24bbf9d11e
bluebottle/homepage/views.py
bluebottle/homepage/views.py
from rest_framework import generics, response from .models import HomePage from .serializers import HomePageSerializer # Instead of serving all the objects separately we combine Slide, Quote and Stats into a dummy object class HomePageDetail(generics.GenericAPIView): serializer_class = HomePageSerializer de...
from django.utils import translation from rest_framework import generics, response from .models import HomePage from .serializers import HomePageSerializer # Instead of serving all the objects separately we combine Slide, Quote and Stats into a dummy object class HomePageDetail(generics.GenericAPIView): seriali...
Fix translations for homepage stats
Fix translations for homepage stats
Python
bsd-3-clause
jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
1c51c772d4b21eba70cd09429e603f1873b2c13c
examples/demo.py
examples/demo.py
#!/usr/bin/env python import pytaf taf_str = """ TAF AMD KDEN 291134Z 2912/3018 32006KT 1/4SM FG OVC001 TEMPO 2914/2915 1SM -BR CLR FM291500 04006KT P6SM SKC TEMPO 2915/2917 2SM BR OVC008 FM291900 05007KT P6SM SCT050 BKN090 WS010/13040KT PROB30 2921/3001 VRB20G30KT -TSRA BKN050CB FM30...
#!/usr/bin/env python import pytaf taf_str = """ TAF AMD KDEN 291134Z 2912/3018 32006KT 1/4SM FG OVC001 TEMPO 2914/2915 1SM -BR CLR FM291500 04006KT P6SM SKC TEMPO 2915/2917 2SM BR OVC008 FM291900 05007KT P6SM SCT050 BKN090 WS010/13040KT PROB30 2921/3001 VRB20G30KT -TSRA BKN050CB FM30...
Update the example script to work with python3.
Update the example script to work with python3.
Python
mit
dmbaturin/pytaf
8a70475983d973b5f9287d7a7c807c55994d3b70
aioriak/tests/test_kv.py
aioriak/tests/test_kv.py
from .base import IntegrationTest, AsyncUnitTestCase class BasicKVTests(IntegrationTest, AsyncUnitTestCase): def test_no_returnbody(self): async def go(): bucket = self.client.bucket(self.bucket_name) o = await bucket.new(self.key_name, "bar") await o.store(return_body=...
from .base import IntegrationTest, AsyncUnitTestCase class BasicKVTests(IntegrationTest, AsyncUnitTestCase): def test_no_returnbody(self): async def go(): bucket = self.client.bucket(self.bucket_name) o = await bucket.new(self.key_name, "bar") await o.store(return_body=...
Add test store unicode object
Add test store unicode object
Python
mit
rambler-digital-solutions/aioriak
992a5a41580a520b330ec0fbbeba4e328924523a
tests/structures/test_list_comprehension.py
tests/structures/test_list_comprehension.py
from ..utils import TranspileTestCase class ListComprehensionTests(TranspileTestCase): def test_syntax(self): self.assertCodeExecution(""" x = [1, 2, 3, 4, 5] print([v**2 for v in x]) print([v for v in x]) """) def test_list_comprehension_with_if_condi...
from ..utils import TranspileTestCase class ListComprehensionTests(TranspileTestCase): def test_syntax(self): self.assertCodeExecution(""" x = [1, 2, 3, 4, 5] print([v**2 for v in x]) print([v for v in x]) """) def test_list_comprehension_with_if_condi...
Add a test for list comprehensions with more than two ifs
Add a test for list comprehensions with more than two ifs
Python
bsd-3-clause
freakboy3742/voc,cflee/voc,cflee/voc,freakboy3742/voc
f5b813b597e7dbc3d6ee3456ddb8318dacd1700b
wheresyourtrash/apps/notifications/tests.py
wheresyourtrash/apps/notifications/tests.py
import mock import unittest from django.test import TestCase from datetime import datetime, timedelta from notifications.models import District, DistrictExceptions, Municipality class DistrictTestCase(TestCase): def setUp(self): today = datetime.now() m = Municipality.objects.create(state="ME", z...
from django.test import TestCase from datetime import datetime, timedelta from notifications.models import District, DistrictExceptions, Municipality class DistrictTestCase(TestCase): def setUp(self): today = datetime.now() m = Municipality.objects.create(state="ME", zipcode="04421", ...
Remove unittest and mock for now
Remove unittest and mock for now
Python
bsd-3-clause
Code4Maine/wheresyourtrash,mainecivichackday/wheresyourtrash,mainecivichackday/wheresyourtrash,mainecivichackday/wheresyourtrash,mainecivichackday/wheresyourtrash,Code4Maine/wheresyourtrash,Code4Maine/wheresyourtrash,Code4Maine/wheresyourtrash
de731520f9ad3f871a976fd597ff1a4d8acf155f
tests/modules/test_enumerable.py
tests/modules/test_enumerable.py
class TestEnumberable(object): def test_inject(self, ec): w_res = ec.space.execute(ec, """ return (5..10).inject(1) do |prod, n| prod * n end """) assert ec.space.int_w(w_res) == 15120 w_res = ec.space.execute(ec, """ return (1..10).inject 0 do |s...
class TestEnumberable(object): def test_inject(self, ec): w_res = ec.space.execute(ec, """ return (5..10).inject(1) do |prod, n| prod * n end """) assert ec.space.int_w(w_res) == 15120 w_res = ec.space.execute(ec, """ return (1..10).inject 0 do |s...
Fix true test, add false test
Fix true test, add false test
Python
bsd-3-clause
babelsberg/babelsberg-r,topazproject/topaz,topazproject/topaz,babelsberg/babelsberg-r,babelsberg/babelsberg-r,babelsberg/babelsberg-r,babelsberg/babelsberg-r,topazproject/topaz,kachick/topaz,kachick/topaz,topazproject/topaz,kachick/topaz
8324b45214dee9cd52c1c9bc85e6d10567dae6e1
plugins/join_on_invite/plugin.py
plugins/join_on_invite/plugin.py
class InviteJoinPlugin(object): def __init__(self, cardinal): cardinal.event_manager.register_callback("irc.invite", self.join_channel) def join_channel(self, cardinal, user, channel): cardinal.join(channel); def setup(cardinal): return InviteJoinPlugin(cardinal)
class InviteJoinPlugin(object): """Simple plugin that joins a channel if an invite is given.""" callback_id = None """ID generated when callback was added for the irc.invite event""" def __init__(self, cardinal): """Register our callback and save the callback ID""" self.callback_id = c...
Remove callback from join_on_invite during close()
Remove callback from join_on_invite during close()
Python
mit
BiohZn/Cardinal,JohnMaguire/Cardinal
ea42e8c61bddf614a5fc444b53eb38dcdcff88af
HotCIDR/hotcidr/ports.py
HotCIDR/hotcidr/ports.py
def parse(s): try: return Port(int(s)) except ValueError: if s == "all": return Port(None) else: start, _, end = s.partition('-') try: return Port(int(start), int(end)) except ValueError: return None class ...
def parse(s): try: return Port(int(s)) except ValueError: if s == "all": return Port(None) else: start, _, end = s.partition('-') try: return Port(int(start), int(end)) except ValueError: return None class ...
Check that input to port is an integer
Check that input to port is an integer
Python
apache-2.0
ViaSat/hotcidr
dc30ef09b024d035ed543c658bfe005d15330111
build/split.py
build/split.py
#!/usr/bin/env python2.7 import json import os import re def main(): session_cells = {n: [] for n in range(1, 6+1)} f = open(os.path.dirname(__file__) + '/../All.ipynb') j = json.load(f) cells = j['cells'] for cell in cells: source = u''.join(cell['source']) m = re.search(r'# +(\d+...
#!/usr/bin/env python2.7 import json import os import re def main(): session_cells = {n: [] for n in range(1, 6+1)} f = open(os.path.dirname(__file__) + '/../All.ipynb') j = json.load(f) cells = j['cells'] for cell in cells: source = u''.join(cell['source']) m = re.search(r'# +(\d+...
Switch to looking for separate solutions files
Switch to looking for separate solutions files
Python
mit
RobbieNesmith/PandasTutorial,Srisai85/pycon-pandas-tutorial,baomingTang/pycon-pandas-tutorial,ledrui/pycon-pandas-tutorial,wkuling/pycon-pandas-tutorial,deepesch/pycon-pandas-tutorial,baomingTang/pycon-pandas-tutorial,jainshailesh/pycon-pandas-tutorial,chrish42/pycon-pandas-tutorial,xy008areshsu/pycon-pandas-tutorial,l...
e6bacdb207bdedd854fceb49378bdea129004e49
bib.py
bib.py
import sqlite3 conn = sqlite3.connect('surfaces.db') c = conn.cursor() c.execute('''CREATE TABLE bibliography ( kdim INT, pg INT, q INT, K2 INT, chi INT, e INT, h11 INT, sp INT, ref TEXT ); ''') rationalsurfaces = [(-1, 0, 0, "NULL", "NULL", "NULL", 0, 4, '''The projective plane, birational to the Hir...
import sqlite3 conn = sqlite3.connect('surfaces.db') c = conn.cursor() c.execute('''CREATE TABLE bibliography ( kdim INT, pg INT, q INT, K2 INT, chi INT, e INT, h11 INT, sp INT, ref TEXT ); ''') rationalsurfaces = [(-1, 0, 0, 9, 3, 1, 0, 7, '''The projective plane, birational to the Hirzebruch surface...
Add a bit more info about rational surfaces
Add a bit more info about rational surfaces
Python
unlicense
jcommelin/superficie-algebriche,jcommelin/superficie-algebriche
b292df611945e15a852db01d61e3b9004307a244
bot.py
bot.py
import os import time from crawl import crawl import tweepy class TwitterAPI: """ Class for accessing the Twitter API. Requires API credentials to be available in environment variables. These will be set appropriately if the bot was created with init.sh included with the heroku-twitterbot-starter...
import os import time from crawl import crawl import tweepy class TwitterAPI: """ Class for accessing the Twitter API. Requires API credentials to be available in environment variables. These will be set appropriately if the bot was created with init.sh included with the heroku-twitterbot-starter...
Speed up for a while
Speed up for a while
Python
mit
gregsabo/only_keep_one,gregsabo/only_keep_one
6032fb8eb10a2f6be28142c7473e03b4bc349c7c
partitions/registry.py
partitions/registry.py
from django.conf import settings class Registry(object): def __init__(self): self._partitions = {} def register(self, key, app_model, expression): if not isinstance(app_model, basestring): app_model = "%s.%s" % ( app_model._meta.app_label, ...
from django.conf import settings class Registry(object): def __init__(self): self._partitions = {} def register(self, key, app_model, expression): if not isinstance(app_model, basestring): app_model = "%s.%s" % ( app_model._meta.app_label, ...
Use update instead of setting key directly
Use update instead of setting key directly
Python
bsd-3-clause
eldarion/django-partitions
abf2f4209f8adf06bef624e9d0a188eba39c2c7a
cinch/lexer.py
cinch/lexer.py
# This is the lexer. We could build a state machine which would parse # each token character by character, but the point of this project is to # be as simple as possible, so we will literally just split the string on # spaces, scrub all newlines, and filter out any empty strings def lex(source): """Lex the source...
import re # This is the lexer. We could build a state machine which would parse # each token character by character, but the point of this project is to # be as simple as possible, so we will literally just split the string on # spaces, scrub all newlines, and filter out any empty strings def lex(source): """Lex...
Remove comments as part of lexing
Remove comments as part of lexing
Python
mit
iankronquist/cinch-lang,tschuy/cinch-lang
b51e4e7af7065a487f5ee91697fda8848c209faf
libpasteurize/fixes/fix_newstyle.py
libpasteurize/fixes/fix_newstyle.py
u""" Fixer for "class Foo: ..." -> "class Foo(object): ..." """ from lib2to3 import fixer_base from lib2to3.fixer_util import LParen, RParen, Name from libfuturize.fixer_util import touch_import_top def insert_object(node, idx): node.insert_child(idx, RParen()) node.insert_child(idx, Name(u"object")) no...
u""" Fixer for "class Foo: ..." -> "class Foo(object): ..." """ from lib2to3 import fixer_base from lib2to3.fixer_util import LParen, RParen, Name from libfuturize.fixer_util import touch_import_top def insert_object(node, idx): node.insert_child(idx, RParen()) node.insert_child(idx, Name(u"object")) no...
Generalize fixer for old->new-style classes to accept "class C():"
Generalize fixer for old->new-style classes to accept "class C():"
Python
mit
michaelpacer/python-future,PythonCharmers/python-future,QuLogic/python-future,krischer/python-future,michaelpacer/python-future,PythonCharmers/python-future,QuLogic/python-future,krischer/python-future
5c12b0c04b25e414b1bd04250cde0c3b1f869104
hr_emergency_contact/models/hr_employee.py
hr_emergency_contact/models/hr_employee.py
# -*- coding: utf-8 -*- # © 2011 Michael Telahun Makonnen <mmakonnen@gmail.com> # © 2016 OpenSynergy Indonesia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields class HrEmployee(models.Model): _name = 'hr.employee' _inherit = 'hr.employee' emergency...
# -*- coding: utf-8 -*- # © 2011 Michael Telahun Makonnen <mmakonnen@gmail.com> # © 2016 OpenSynergy Indonesia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields class HrEmployee(models.Model): _inherit = 'hr.employee' emergency_contact_ids = fields.Many...
Remove _name attribute on hr.employee
Remove _name attribute on hr.employee
Python
agpl-3.0
VitalPet/hr,thinkopensolutions/hr,VitalPet/hr,xpansa/hr,Eficent/hr,Eficent/hr,feketemihai/hr,feketemihai/hr,acsone/hr,open-synergy/hr,open-synergy/hr,xpansa/hr,acsone/hr,thinkopensolutions/hr
7b4f69971684bf2c5abfa50876583eb7c640bdac
kuulemma/views/feedback.py
kuulemma/views/feedback.py
from flask import Blueprint, abort, jsonify, request from flask.ext.mail import Message from kuulemma.extensions import db, mail from kuulemma.models import Feedback from kuulemma.settings.base import FEEDBACK_RECIPIENTS feedback = Blueprint( name='feedback', import_name=__name__, url_prefix='/feedback' )...
from flask import abort, Blueprint, jsonify, request from flask.ext.mail import Message from kuulemma.extensions import db, mail from kuulemma.models import Feedback from kuulemma.settings.base import FEEDBACK_RECIPIENTS feedback = Blueprint( name='feedback', import_name=__name__, url_prefix='/feedback' )...
Fix order of imports to comply with isort
Fix order of imports to comply with isort
Python
agpl-3.0
City-of-Helsinki/kuulemma,fastmonkeys/kuulemma,City-of-Helsinki/kuulemma,fastmonkeys/kuulemma,City-of-Helsinki/kuulemma,fastmonkeys/kuulemma
43cc10fff32ef98522ba100da34816049908abb7
zeus/api/resources/auth_index.py
zeus/api/resources/auth_index.py
from flask import session from zeus import auth from zeus.models import Identity, User from .base import Resource from ..schemas import IdentitySchema, UserSchema user_schema = UserSchema(strict=True) identities_schema = IdentitySchema(many=True, strict=True) class AuthIndexResource(Resource): auth_required = ...
from flask import session from zeus import auth from zeus.models import Email, Identity, User from .base import Resource from ..schemas import EmailSchema, IdentitySchema, UserSchema emails_schema = EmailSchema(many=True, strict=True) identities_schema = IdentitySchema(many=True, strict=True) user_schema = UserSchem...
Add emails to auth details
Add emails to auth details
Python
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
692234e72862839d8c14fb0f1a6ebe7259b15413
core/report.py
core/report.py
import config def sendMail(): print config.config print "Sent e-mail" def sendToGrapite(): pass
from config import config as conf from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import smtplib import time import pushnotify def sendMail(recipients, subject, body): if not isinstance( recipients, list ): recipients = [ recipients ] session = smtplib.SMTP( conf.ge...
Complete e-mail, Graphite and push notification support
Complete e-mail, Graphite and push notification support
Python
mit
nlindblad/ocarina,nlindblad/ocarina
482bed9a37f49ba4ae68c94cf69edf28586be07d
examples/bank_account_debits.py
examples/bank_account_debits.py
''' Learn how to verify a bank account so you can debit with it. ''' from __future__ import unicode_literals import balanced def init(): key = balanced.APIKey().save() balanced.configure(key.secret) balanced.Marketplace().save() def main(): init() # create a bank account bank_account = bal...
''' Learn how to verify a bank account so you can debit with it. ''' from __future__ import unicode_literals import balanced def init(): key = balanced.APIKey().save() balanced.configure(key.secret) balanced.Marketplace().save() def main(): init() # create a bank account bank_account = bal...
Update example for bank account debits for confirm()
Update example for bank account debits for confirm()
Python
mit
balanced/balanced-python,trenton42/txbalanced
41fccd9d5060f2b8dcedde2cb9ab3391b48df420
scripts/generate_input_syntax.py
scripts/generate_input_syntax.py
#!/usr/bin/env python import sys, os # get the location of this script app_path = os.path.abspath(os.path.dirname(sys.argv[0])) # this script is actually in the scripts subdirectory, so go up a level app_path += '/..' # Set the name of the application here and moose directory relative to the application app_name = 'R...
#!/usr/bin/env python import sys, os # get the location of this script app_path = os.path.abspath(os.path.dirname(sys.argv[0])) # Set the name of the application here and moose directory relative to the application app_name = 'raven' MOOSE_DIR = os.path.abspath(os.path.join(app_path, '..', '..' 'moose')) FRAMEWORK_D...
Update scripts to reflect new MOOSE_DIR definition
Update scripts to reflect new MOOSE_DIR definition r25009
Python
apache-2.0
idaholab/raven,idaholab/raven,idaholab/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven
1cfaf387af8e373d2bf3fdc8d6144f889489ba13
esis/cli.py
esis/cli.py
# -*- coding: utf-8 -*- """Elastic Search Index & Search.""" import argparse def main(): """Entry point for the esis.py script.""" args = parse_arguments() print args def parse_arguments(): """Parse command line arguments. :returns: Parsed arguments :rtype: argparse.Namespace """ p...
# -*- coding: utf-8 -*- """Elastic Search Index & Search.""" import argparse import os def main(): """Entry point for the esis.py script.""" args = parse_arguments() print args def valid_directory(path): """Directory validation.""" if not os.path.isdir(path): raise argparse.ArgumentTypeE...
Add directory validation to argument parsing
Add directory validation to argument parsing
Python
mit
jcollado/esis
c9215a00bfe8d1edaf2840f6cd4b3ae8061c26f5
allauth_uwum/provider.py
allauth_uwum/provider.py
"""The UWUM (Unified WeGovNow User Management) provider.""" from allauth.socialaccount import app_settings from allauth.socialaccount.providers import registry from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class UWUMAccount...
"""The UWUM (Unified WeGovNow User Management) provider.""" from allauth.socialaccount import app_settings from allauth.socialaccount.providers import registry from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class UWUMAccount...
Set "notify_email" in default scope only if settings allow it
Set "notify_email" in default scope only if settings allow it
Python
mit
ExCiteS/django-allauth-uwum
1a16281c6591ab059db09ab5a8af4826d3f3698a
eche.py
eche.py
#!env python """Eche - a simple, lisp like language. Usage: eche FILE ... eche (-h | --help) eche --version Options: -h --help Show this screen. --version Show version. """ import sys import pathlib from docopt import docopt sys.path.append(str(pathlib.Path('.').joinpath('eche'))) import ...
#!env python """Eche - a simple, lisp like language. Usage: eche [FILE ...] eche (-h | --help) eche --version Options: -h --help Show this screen. --version Show version. """ import sys import pathlib from docopt import docopt sys.path.append(str(pathlib.Path('.').joinpath('eche'))) impor...
Change args to show repl if no FILEs are given.
Change args to show repl if no FILEs are given.
Python
mit
skk/eche
e76ca364ab979e309d34ff458ef2629145a52ce2
magnum/db/sqlalchemy/alembic/versions/a1136d335540_add_docker_storage_driver_column.py
magnum/db/sqlalchemy/alembic/versions/a1136d335540_add_docker_storage_driver_column.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Fix for enum type docker_storage_driver
Fix for enum type docker_storage_driver Create enum type "docker_storage_driver" for migration This is fixing oslo_db.exception.DBError: (psycopg2.ProgrammingError) type "docker_storage_driver" does not exist Closes-Bug: #1609776 Change-Id: I92d427e90bd73b4114d8688d3761cabac450fc9d
Python
apache-2.0
openstack/magnum,openstack/magnum,ArchiFleKs/magnum,ArchiFleKs/magnum
6881d127cf55dc96c44467ea807a9288a5108dff
scripts/lib/check_for_course_revisions.py
scripts/lib/check_for_course_revisions.py
from collections import OrderedDict import json from .load_data_from_file import load_data_from_file from .get_old_dict_values import get_old_dict_values from .log import log from .paths import make_course_path def load_previous(course_path): try: prior_data = load_data_from_file(course_path) prior = json.loads...
from collections import OrderedDict from tzlocal import get_localzone import json from .load_data_from_file import load_data_from_file from .get_old_dict_values import get_old_dict_values from .log import log from .paths import make_course_path def load_previous(course_path): try: prior_data = load_data_from_file...
Add '_updated' property to revisions
Add '_updated' property to revisions
Python
mit
StoDevX/course-data-tools,StoDevX/course-data-tools
646e376a8e9bdc1daaa38ebee2de39e945ab443d
tests/test_cookiecutter_generation.py
tests/test_cookiecutter_generation.py
# -*- coding: utf-8 -*- import pytest @pytest.fixture def context(): return { "project_name": "My Test Project", "repo_name": "my_test_project", "author_name": "Test Author", "email": "test@example.com", "description": "A short description of the project.", "domain_...
# -*- coding: utf-8 -*- import os import re import pytest from binaryornot.check import is_binary PATTERN = "{{(\s?cookiecutter)[.](.*?)}}" RE_OBJ = re.compile(PATTERN) @pytest.fixture def context(): return { "project_name": "My Test Project", "repo_name": "my_test_project", "author_nam...
Integrate additional checks of base.py with slight improvements
Integrate additional checks of base.py with slight improvements
Python
bsd-3-clause
webyneter/cookiecutter-django,kappataumu/cookiecutter-django,crdoconnor/cookiecutter-django,gappsexperts/cookiecutter-django,mjhea0/cookiecutter-django,mistalaba/cookiecutter-django,calculuscowboy/cookiecutter-django,hairychris/cookiecutter-django,kappataumu/cookiecutter-django,thisjustin/cookiecutter-django,ddiazpinto...
cf457a8ba688b33748bb03baa5a77d9b4e638e9d
emote/emote.py
emote/emote.py
""" A simple CLI tool for quickly copying common emoticon/emoji to your clipboard. """ import pyperclip import json import sys import argparse with open("mapping.json") as f: emotes = json.load(f) def main(): parser = argparse.ArgumentParser( description=sys.modules[__name__].__doc__, ...
""" A simple CLI tool for quickly copying common emoticon/emoji to your clipboard. """ import pyperclip import json import sys import argparse with open("mapping.json") as f: emotes = json.load(f) def parse_arguments(): parser = argparse.ArgumentParser( description=sys.modules[__name__].__doc__, ...
Add partially implemented list option.
Add partially implemented list option.
Python
mit
d6e/emotion
f76a66809237af29de8bfaeacd017d8f8b60df78
python/http_checker.py
python/http_checker.py
import unittest import requests import lxml.html class TestHtmlTask(unittest.TestCase): def setUp(self): self.ulr_google = "https://www.google.com.ua/" self.url_habr = "http://habrahabr.ru/hub/gdev/" def test_1(self): expected_response_1 = 200 r = requests.get(self.ulr_google)...
import unittest import requests import lxml.html import xmlrunner class TestHtmlTask(unittest.TestCase): def setUp(self): self.urls = open("urls.txt", 'r') self.url_google = self.urls.readline() self.url_habr = self.urls.readline() self.urls.close() def test_1(self): e...
Save test results to XML added
Save test results to XML added
Python
mit
amazpyel/sqa_training,amazpyel/sqa_training,amazpyel/sqa_training
9864f9c60e65fa73f15504950df5ce71baf23dcb
ideascube/utils.py
ideascube/utils.py
import sys from django.conf import settings class classproperty(property): """ Use it to decorate a classmethod to make it a "class property". """ def __get__(self, cls, owner): return self.fget.__get__(None, owner)() def get_server_name(): # Import here to avoid cyclic import from ...
import sys from django.conf import settings class classproperty(property): """ Use it to decorate a classmethod to make it a "class property". """ def __get__(self, cls, owner): return self.fget.__get__(None, owner)() def get_server_name(): # Import here to avoid cyclic import from ...
Use the API as it was intended
Use the API as it was intended
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
088eb8d51f0092c9cfa62c490ae5a9ad111061e0
webapp/byceps/util/templatefilters.py
webapp/byceps/util/templatefilters.py
# -*- coding: utf-8 -*- """ byceps.util.templatefilters ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provide and register custom template filters. :Copyright: 2006-2015 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from . import dateformat, money def dim(value): """Render value in a way so that it ...
# -*- coding: utf-8 -*- """ byceps.util.templatefilters ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provide and register custom template filters. :Copyright: 2006-2015 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from jinja2 import evalcontextfilter, Markup from . import dateformat, money @evalconte...
Mark HTML generated by custom template filter as safe if auto-escaping is enabled.
Mark HTML generated by custom template filter as safe if auto-escaping is enabled.
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps
f857771d98627722bc9c81ee3d039ab11c3e8afb
jsonfield/utils.py
jsonfield/utils.py
import datetime from decimal import Decimal from django.core.serializers.json import DjangoJSONEncoder class TZAwareJSONEncoder(DjangoJSONEncoder): def default(self, obj): if isinstance(obj, datetime.datetime): return obj.strftime("%Y-%m-%d %H:%M:%S%z") return super(TZAwareJSONEncoder,...
import datetime from decimal import Decimal from django.core.serializers.json import DjangoJSONEncoder DATETIME = (datetime.datetime,) DATE = (datetime.date,) TIME = (datetime.time,) try: import freezegun.api except ImportError: pass else: DATETIME += (freezegun.api.FakeDatetime,) DATE += (freezegun....
Make compatible with freezegun when testing.
Make compatible with freezegun when testing.
Python
bsd-3-clause
SideStudios/django-jsonfield
c2cfb617d9bedf93e2c6dfb5ff6cdfcd35d5c0fe
db/shot_attempt.py
db/shot_attempt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import uuid from db.common import Base from db.specific_event import SpecificEvent class ShotAttempt(Base, SpecificEvent): __tablename__ = 'shot_attempts' __autoload__ = True STANDARD_ATTRS = [ "game_id", "team_id", "event_id", "player_id", "shot_at...
#!/usr/bin/env python # -*- coding: utf-8 -*- import uuid from sqlalchemy import and_ from db.common import Base, session_scope from db.specific_event import SpecificEvent class ShotAttempt(Base, SpecificEvent): __tablename__ = 'shot_attempts' __autoload__ = True STANDARD_ATTRS = [ "game_id", ...
Add method to find by event and player id
Add method to find by event and player id
Python
mit
leaffan/pynhldb
3fe4cb6fbafe69b9e7520466b7e7e2d405cf0ed0
bookmarks/forms.py
bookmarks/forms.py
from django import forms from django.utils.translation import ugettext_lazy as _ from tagging.forms import TagField from bookmarks.models import Bookmark, BookmarkInstance class BookmarkInstanceForm(forms.ModelForm): url = forms.URLField(label = "URL", verify_exists=True, widget=forms.TextInput(attrs={"size...
from django import forms from django.utils.translation import ugettext_lazy as _ from tagging.forms import TagField from bookmarks.models import Bookmark, BookmarkInstance class BookmarkInstanceForm(forms.ModelForm): url = forms.URLField(label = "URL", widget=forms.TextInput(attrs={"size": 40})) descrip...
Make URLField compatible with Django 1.4 and remove verify_exists attribute
Make URLField compatible with Django 1.4 and remove verify_exists attribute
Python
mit
incuna/incuna-bookmarks,incuna/incuna-bookmarks
be9d4292e8357d637ebc7e73e1b2333766db5997
braid/postgres.py
braid/postgres.py
from fabric.api import sudo from braid import package def install(): package.install(['postgresql-9.1', 'postgresql-server-dev-9.1']) def createUser(name): sudo('createuser -D -R -S {}'.format(name), user='postgres') def createDb(name, owner): sudo('createdb -O {} {}'.format(owner, name), user='postgr...
from fabric.api import sudo, quiet from braid import package from pipes import quote def install(): package.install(['postgresql-9.1', 'postgresql-server-dev-9.1']) def _runQuery(query): with quiet(): return sudo('psql --no-align --no-readline --no-password --quiet ' '--tuples-onl...
Make createDb and createUser idempotent.
Make createDb and createUser idempotent.
Python
mit
alex/braid,alex/braid
b48b41fb9634c7e12b805e8bd3ca4f0abb942c3a
django/__init__.py
django/__init__.py
VERSION = (1, 0, 'post-release-SVN') def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if VERSION[-1]: from django.utils.version import get_svn_revision v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision()) return v
VERSION = (1, 1, 0, 'alpha', 0) 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 ...
Update django.VERSION in trunk per previous discussion
Update django.VERSION in trunk per previous discussion --HG-- extra : convert_revision : svn%3Abcc190cf-cafb-0310-a4f2-bffc1f526a37/django/trunk%409103
Python
bsd-3-clause
Belgabor/django,Belgabor/django,Belgabor/django
a3b31e3ad7358709b27f91a249ac0a622f9661cb
server/python_django/file_uploader/__init__.py
server/python_django/file_uploader/__init__.py
""" @author: Ferdinand E. Silva @email: ferdinandsilva@ferdinandsilva.com @website: http://ferdinandsilva.com """ import os from django.utils import simplejson as json class qqFileUploader(object): def __init__(self, allowedExtensions=None, sizeLimit=1024): self.allowedExtensions = allowedExtensions or [...
""" @author: Ferdinand E. Silva @email: ferdinandsilva@ferdinandsilva.com @website: http://ferdinandsilva.com """ import os from django.utils import simplejson as json class qqFileUploader(object): def __init__(self, allowedExtensions=None, sizeLimit=1024): self.allowedExtensions = allowedExtensions or [...
Read the file content, if it is not read when the request is multipart then the client get an error
Read the file content, if it is not read when the request is multipart then the client get an error
Python
mit
SimonWaldherr/uploader,SimonWaldherr/uploader,FineUploader/fine-uploader,FineUploader/fine-uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,FineUploader/fine-uploader,SimonWaldherr/uploader,SimonWaldherr/uploader
073b55113ac91b2f6fcfbebe9550f0740f8149d4
jxaas/utils.py
jxaas/utils.py
import logging from cliff.command import Command import jujuxaas.client def get_jxaas_client(command): tenant = 'abcdef' username = '123' password= '123' client = jujuxaas.client.Client(url="http://127.0.0.1:8080/xaas", tenant=tenant, username=username, password=password) return client
import logging import os from cliff.command import Command import jujuxaas.client def get_jxaas_client(command): tenant = 'abcdef' username = '123' password= '123' url = os.getenv('JXAAS_URL', "http://127.0.0.1:8080/xaas") client = jujuxaas.client.Client(url=url, tenant=tenant, username=username, password...
Allow JXAAS_URL to be configured as an env var
Allow JXAAS_URL to be configured as an env var
Python
apache-2.0
jxaas/cli
507a4f7f931c12c9883ff1644f5d0cc44270d5c2
salt/thorium/status.py
salt/thorium/status.py
# -*- coding: utf-8 -*- ''' This thorium state is used to track the status beacon events and keep track of the active status of minions .. versionadded:: 2016.11.0 ''' # Import python libs from __future__ import absolute_import import time import fnmatch def reg(name): ''' Activate this register to turn on a...
# -*- coding: utf-8 -*- ''' This thorium state is used to track the status beacon events and keep track of the active status of minions .. versionadded:: 2016.11.0 ''' # Import python libs from __future__ import absolute_import import time import fnmatch def reg(name): ''' Activate this register to turn on a...
Reorder keys that were being declared in the wrong place
Reorder keys that were being declared in the wrong place
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
e5a397033c5720cd7d0ab321c05a8f1d12f4dc99
tm/tmux_wrapper.py
tm/tmux_wrapper.py
# -*- coding: utf-8 -*- import subprocess class SessionExists(Exception): description = "Session already exists." pass class ServerConnectionError(Exception): description = "tmux server is not currently running." pass class SessionDoesNotExist(Exception): description = "Session does not exist...
# -*- coding: utf-8 -*- import subprocess class SessionExists(Exception): description = "Session already exists." pass class ServerConnectionError(Exception): description = "tmux server is not currently running." pass class SessionDoesNotExist(Exception): description = "Session does not exist...
Use raw command method to run all commands in wrapper
Use raw command method to run all commands in wrapper
Python
mit
ethanal/tm
cd22543319e4c21b693f91768adcc1cd42aa08a3
calexicon/fn/overflow.py
calexicon/fn/overflow.py
class OverflowDate(object): def __init__(self, **info): self.info = info def isocalendar(self): if 'isocalendar' in self.info: return self.info['isocalendar'] return None
class OverflowDate(object): def __init__(self, **info): self.info = info def isocalendar(self): if 'isocalendar' in self.info: return self.info['isocalendar']
Remove this line - it is redundant and missing code coverage.
Remove this line - it is redundant and missing code coverage.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
e201f3179388414d0ac6fc9d3a641dda3a5930be
snafu/installations.py
snafu/installations.py
import contextlib import itertools import os import pathlib import re import subprocess import attr @attr.s class Installation: path = attr.ib(convert=pathlib.Path) @property def python(self): return self.path.joinpath('python.exe') @property def scripts_dir(self): return self....
import contextlib import itertools import os import pathlib import re import subprocess import attr @attr.s class Installation: path = attr.ib(convert=pathlib.Path) @property def python(self): return self.path.joinpath('python.exe') @property def scripts_dir(self): return self....
Fix installation version info type
Fix installation version info type
Python
isc
uranusjr/snafu,uranusjr/snafu
5702672ab40ef23089c7a2dfee22aaf539b19a54
dpaste/settings/tests.py
dpaste/settings/tests.py
""" Settings for the test suite """ from .base import *
""" Settings for the test suite """ from .base import * DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }
Use in-memory sqlite db for testing.
Use in-memory sqlite db for testing.
Python
mit
bartTC/dpaste,bartTC/dpaste,bartTC/dpaste
ab6293bbe039cb0c939493c3b921f114ad68645b
tests/test_plugin_execute.py
tests/test_plugin_execute.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ test_onebot_execute ---------------------------------- Tests for Execute plugin """ from irc3.testing import BotTestCase class ExecutePluginTestCase(BotTestCase): config = { 'includes': [ 'onebot.plugins.execute' ], 'onebot...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ test_onebot_execute ---------------------------------- Tests for Execute plugin """ from irc3.testing import BotTestCase class ExecutePluginTestCase(BotTestCase): config = { 'includes': [ 'onebot.plugins.execute' ], 'onebot...
Fix test for connection made
Fix test for connection made
Python
bsd-3-clause
thomwiggers/onebot
dbf1298d3adec2f2aab56bbbccec5de98cbaf15c
tools/examples/check-modified.py
tools/examples/check-modified.py
#!/usr/bin/python # # USAGE: check-modified.py FILE_OR_DIR1 FILE_OR_DIR2 ... # # prints out the URL associated with each item # import sys import os import os.path import svn.util import svn.client import svn.wc def usage(): print "Usage: " + sys.argv[0] + " FILE_OR_DIR1 FILE_OR_DIR2\n" sys.exit(0) def run(files...
#!/usr/bin/python # # USAGE: check-modified.py FILE_OR_DIR1 FILE_OR_DIR2 ... # # prints out the URL associated with each item # import sys import os import os.path import svn.util import svn.client import svn.wc FORCE_COMPARISON = 0 def usage(): print "Usage: " + sys.argv[0] + " FILE_OR_DIR1 FILE_OR_DIR2\n" sys....
Fix a broken example script.
Fix a broken example script. * check-modified.py (FORCE_COMPARISON): New variable. (run): Add FORCE_COMPARISON arg to call to svn_wc_text_modified_p. git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@850428 13f79535-47bb-0310-9956-ffa450edef68
Python
apache-2.0
wbond/subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion
9df3f3a2d0660b8e8166aa944bf45f261a51d987
ies_base/serializers.py
ies_base/serializers.py
from rest_framework import serializers class Tag(object): def __init__(self, name, related_tags, equivalent_names): self.name = name self.related_tags = related_tags self.equivalent_names = equivalent_names class TagSerializer(serializers.Serializer): name = serializers.CharField() ...
from rest_framework import serializers class Tag(object): def __init__(self, name, related_tags, equivalent_names): self.name = name self.related_tags = related_tags self.equivalent_names = equivalent_names class TagSerializer(serializers.Serializer): name = serializers.CharField() ...
Make default color not required
Make default color not required
Python
mit
InstanteSports/ies-django-base
218265d65695e777cd3e010c6a0108fad6fea5f6
beavy/common/including_hyperlink_related.py
beavy/common/including_hyperlink_related.py
from marshmallow_jsonapi.fields import HyperlinkRelated from marshmallow_jsonapi.utils import get_value_or_raise class IncludingHyperlinkRelated(HyperlinkRelated): def __init__(self, nestedObj, *args, **kwargs): if callable(nestedObj): nestedObj = nestedObj(many=False) self.nestedOb...
from marshmallow_jsonapi.fields import HyperlinkRelated from marshmallow_jsonapi.utils import get_value_or_raise class IncludingHyperlinkRelated(HyperlinkRelated): def __init__(self, nestedObj, *args, **kwargs): if callable(nestedObj): nestedObj = nestedObj(many=False) self.nestedOb...
Enforce that our Including Hyperlink includes
Enforce that our Including Hyperlink includes
Python
mpl-2.0
beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy
c9f21a389028ed3b831286dc6c3991f48faa6e81
app/soc/mapreduce/convert_project_mentors.py
app/soc/mapreduce/convert_project_mentors.py
#!/usr/bin/python2.5 # # Copyright 2011 the Melange authors. # # 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...
#!/usr/bin/python2.5 # # Copyright 2011 the Melange authors. # # 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...
Remove the check for existence of project since mapreduce API guarantees that.
Remove the check for existence of project since mapreduce API guarantees that. Also remove unused imports.
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
71a2cc9a036cee2b541b149e57d162004500bfbb
wagtaildraftail/wagtail_hooks.py
wagtaildraftail/wagtail_hooks.py
from django.utils.html import format_html from django.contrib.staticfiles.templatetags.staticfiles import static from wagtail.wagtailcore import hooks @hooks.register('insert_editor_js') def draftail_editor_js(): return format_html('<script src="{0}"></script>', static('wagtaildraftail/wagt...
from django.utils.html import format_html from django.contrib.staticfiles.templatetags.staticfiles import static from wagtail.wagtailcore import hooks @hooks.register('insert_editor_js') def draftail_editor_js(): return format_html('<script src="{0}"></script>', static('wagtaildraftail/wagtaildraftail.js')) @ho...
Add hook to load CSS
Add hook to load CSS
Python
mit
springload/wagtaildraftail,gasman/wagtaildraftail,gasman/wagtaildraftail,springload/wagtaildraftail,springload/wagtaildraftail,springload/wagtaildraftail,gasman/wagtaildraftail,gasman/wagtaildraftail
494d35234e30d368a9539910ff3ad6d45ed73125
containers/containers.py
containers/containers.py
try: from urllib import urlretrieve except ImportError: from urllib.request import urlretrieve try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse import os def simple_discovery(path, var=None, secure=True): if secure: protocol = 'https' else: ...
try: from urllib import urlretrieve except ImportError: from urllib.request import urlretrieve try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse import os def simple_discovery(name, var=None, secure=True): '''Perform simple discovery and save the discovered...
Add better docstring to simple_discovery
Add better docstring to simple_discovery
Python
mit
kragniz/containers
999d7a337c0bb2b55da85019abba26edbf5f467a
ceviche/__init__.py
ceviche/__init__.py
# used for setup.py name = "ceviche" __version__ = '0.0.1' from .fdtd import fdtd from .fdfd import fdfd_ez, fdfd_hz, fdfd_ez_nl from .jacobians import jacobian from . import viz
# used for setup.py name = "ceviche" __version__ = '0.0.1' from .fdtd import fdtd from .fdfd import fdfd_ez, fdfd_hz, fdfd_ez_nl from .jacobians import jacobian from . import viz from . import modes from . import utils
Add modes and utils submodules
Add modes and utils submodules
Python
mit
fancompute/ceviche,fancompute/ceviche
1ba4d84fb72a343cdf288d905d2029f1d2fbee12
wagtail/api/v2/pagination.py
wagtail/api/v2/pagination.py
from collections import OrderedDict from django.conf import settings from rest_framework.pagination import BasePagination from rest_framework.response import Response from .utils import BadRequestError class WagtailPagination(BasePagination): def paginate_queryset(self, queryset, request, view=None): li...
from collections import OrderedDict from django.conf import settings from rest_framework.pagination import BasePagination from rest_framework.response import Response from .utils import BadRequestError class WagtailPagination(BasePagination): def paginate_queryset(self, queryset, request, view=None): li...
Remove assert from WagtailPagination.paginate_queryset method
Remove assert from WagtailPagination.paginate_queryset method
Python
bsd-3-clause
mikedingjan/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,jnns/wagtail,mixxorz/wagtail,wagtail/wagtail,mixxorz/wagtail,FlipperPA/wagtail,wagtail/wagtail,gasman/wagtail,zerolab/wagtail,torchbox/wagtail,mikedingjan/wagtail,timorieber/wagtail,zerolab/wagtail,gasman/wagtail,jnns/wagtail,zerolab/wagtail,kaedroho/wagtail,thenewg...
75dc15e5c4a9cf6e442dbe9e14d3f78f977b2e68
diesel/logmod.py
diesel/logmod.py
# vim:ts=4:sw=4:expandtab '''A simple logging module that supports various verbosity levels and component-specific subloggers. ''' import sys import time from twiggy import log as olog, add_emitters, levels, outputs, formats, emitters from functools import partial diesel_format = formats.line_format diesel_format.tra...
# vim:ts=4:sw=4:expandtab '''A simple logging module that supports various verbosity levels and component-specific subloggers. ''' import sys import time from twiggy import log as olog, levels, outputs, formats, emitters try: from twiggy import add_emitters except ImportError: from twiggy import addEmitters as...
Support Twiggy 0.2 and 0.4 APIs
Support Twiggy 0.2 and 0.4 APIs
Python
bsd-3-clause
dieseldev/diesel
1494bc56008f50f24d9046f7713b27a250b54eeb
skimage/transform/setup.py
skimage/transform/setup.py
#!/usr/bin/env python import os from skimage._build import cython base_path = os.path.abspath(os.path.dirname(__file__)) def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs config = Configuration('transform', parent_package, top_...
#!/usr/bin/env python import os from skimage._build import cython base_path = os.path.abspath(os.path.dirname(__file__)) def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs config = Configuration('transform', parent_package, top_...
Remove unused fopenmp compile args
Remove unused fopenmp compile args
Python
bsd-3-clause
bennlich/scikit-image,rjeli/scikit-image,SamHames/scikit-image,dpshelio/scikit-image,ClinicalGraphics/scikit-image,Hiyorimi/scikit-image,pratapvardhan/scikit-image,emon10005/scikit-image,chintak/scikit-image,michaelaye/scikit-image,newville/scikit-image,ofgulban/scikit-image,chintak/scikit-image,blink1073/scikit-image,...
a62d038885dcf0b97c544f3b091f2bfba7cc23d7
kitsune/sumo/widgets.py
kitsune/sumo/widgets.py
# Based on http://djangosnippets.org/snippets/1580/ from django import forms class ImageWidget(forms.FileInput): """ A ImageField Widget that shows a thumbnail. """ def __init__(self, attrs={}): super(ImageWidget, self).__init__(attrs) def render(self, name, value, attrs=None): o...
# Based on http://djangosnippets.org/snippets/1580/ from django import forms class ImageWidget(forms.FileInput): """ A ImageField Widget that shows a thumbnail. """ def __init__(self, attrs={}): super(ImageWidget, self).__init__(attrs) def render(self, name, value, attrs=None, renderer=N...
Add required renderer argument to Widget.render() call
Add required renderer argument to Widget.render() call mozilla/sumo-project#136
Python
bsd-3-clause
mozilla/kitsune,mozilla/kitsune,mozilla/kitsune,mozilla/kitsune
c8cfce2cd4820d937d10dced4472055921342582
cyder/core/ctnr/forms.py
cyder/core/ctnr/forms.py
from django import forms from cyder.base.constants import LEVELS from cyder.base.mixins import UsabilityFormMixin from cyder.core.ctnr.models import Ctnr class CtnrForm(forms.ModelForm, UsabilityFormMixin): class Meta: model = Ctnr exclude = ('users',) def filter_by_ctnr_all(self, ctnr): ...
from django import forms from cyder.base.constants import LEVELS from cyder.base.mixins import UsabilityFormMixin from cyder.core.ctnr.models import Ctnr class CtnrForm(forms.ModelForm, UsabilityFormMixin): class Meta: model = Ctnr exclude = ('users', 'domains', 'ranges', 'workgroups') def f...
Remove m2m fields from ctnr edit form
Remove m2m fields from ctnr edit form
Python
bsd-3-clause
akeym/cyder,drkitty/cyder,OSU-Net/cyder,akeym/cyder,OSU-Net/cyder,OSU-Net/cyder,murrown/cyder,drkitty/cyder,OSU-Net/cyder,akeym/cyder,murrown/cyder,drkitty/cyder,murrown/cyder,murrown/cyder,drkitty/cyder,akeym/cyder
dd4015874d6e7ab377795177876fe46a934bf741
testinfra/mon/test_ossec_ruleset.py
testinfra/mon/test_ossec_ruleset.py
import re alert_level_regex = re.compile(r"Level: '(\d+)'") def test_grsec_denied_rwx_mapping_produces_alert(Command, Sudo): """Check that a denied RWX mmaping produces an OSSEC alert""" test_alert = ("Feb 10 23:34:40 app kernel: [ 124.188641] grsec: denied " "RWX mmap of <anonymous mappi...
import re alert_level_regex = re.compile(r"Level: '(\d+)'") def test_grsec_denied_rwx_mapping_produces_alert(Command, Sudo): """Check that a denied RWX mmaping produces an OSSEC alert""" test_alert = ("Feb 10 23:34:40 app kernel: [ 124.188641] grsec: denied " "RWX mmap of <anonymous mappi...
Add test to reproduce overloaded Tor guard OSSEC alert
Add test to reproduce overloaded Tor guard OSSEC alert A Tor log event indicating that a Tor guard in use is overloaded currently produces an OSSEC alert. While this alert is an excellent candidate to be sent upstream to FPF for analysis, there is no action that a SecureDrop administrator is expected to take, making t...
Python
agpl-3.0
garrettr/securedrop,ehartsuyker/securedrop,micahflee/securedrop,heartsucker/securedrop,conorsch/securedrop,garrettr/securedrop,micahflee/securedrop,conorsch/securedrop,ehartsuyker/securedrop,micahflee/securedrop,conorsch/securedrop,conorsch/securedrop,micahflee/securedrop,heartsucker/securedrop,conorsch/securedrop,garr...
50621ef5b141470879a786088391a516b4f63d52
note/models.py
note/models.py
from django.db import models from django.contrib.auth.models import User # Create your models here. # Create your models here. class Note(models.Model): # always reference the User class using setting conf author = models.ForeignKey(User) value = models.IntegerField(max_length=255) def __str__(self): ...
from django.db import models from django.conf import settings # Create your models here. # Create your models here. class Note(models.Model): # always reference the User class using setting conf author = models.ForeignKey(settings.AUTH_USER_MODEL) value = models.IntegerField(max_length=255) def __str__...
Migrate to a custom User class.
Migrate to a custom User class. Step1: reference the User class, using the AUTH_USER_MODEL setting.
Python
bsd-2-clause
LeMeteore/boomer2
3b28a1fa47d4e2339f2219eaf688b88b5901afea
migrations/versions/0074_update_sms_rate.py
migrations/versions/0074_update_sms_rate.py
"""empty message Revision ID: 0074_update_sms_rate Revises: 0072_add_dvla_orgs Create Date: 2017-04-24 12:10:02.116278 """ import uuid revision = '0074_update_sms_rate' down_revision = '0072_add_dvla_orgs' from alembic import op def upgrade(): op.get_bind() op.execute("INSERT INTO provider_rates (id, val...
"""empty message Revision ID: 0074_update_sms_rate Revises: 0073_add_international_sms_flag Create Date: 2017-04-24 12:10:02.116278 """ import uuid revision = '0074_update_sms_rate' down_revision = '0073_add_international_sms_flag' from alembic import op def upgrade(): op.get_bind() op.execute("INSERT IN...
Fix db migration merge conflicts
Fix db migration merge conflicts
Python
mit
alphagov/notifications-api,alphagov/notifications-api
529ab85ac8a25b05690f507ed67ba767d4fb53db
pyEchosign/utils/handle_response.py
pyEchosign/utils/handle_response.py
from requests import Response def check_error(response: Response): """ Takes a requests package response object and checks the error code and raises the proper exception """ response_json = response.json() code = response_json.get('code', None) if response.status_code == 401: raise Per...
from requests import Response from exceptions.internal_exceptions import ApiError def check_error(response: Response): """ Takes a requests package response object and checks the error code and raises the proper exception """ if response.status_code == 401: raise PermissionError('Echosign API...
Check for json() ValueError with requests when raising an ApiError in check_error()
Check for json() ValueError with requests when raising an ApiError in check_error()
Python
mit
JensAstrup/pyEchosign
b9cf2f0daf2ca360c64d1268d50cab9c07020222
test_engine.py
test_engine.py
import engine VALID_COORDS = [(x, y) for x in xrange(97, 105) for y in xrange(49, 57)] INVALID_COORDS = [ (0, 0), (-1, -1), (96, 49), (96, 48), (105, 49), (104, 48), (96, 56), (97, 57), (105, 56), (104, 57) ] VALID_A1 = [chr(x) + chr(y) for x in xrange(97, 105) for y in xrange(49, 57)] INVALID...
import engine VALID_COORDS = [(x, y) for x in xrange(97, 105) for y in xrange(49, 57)] INVALID_COORDS = [ (0, 0), (-1, -1), (96, 49), (96, 48), (105, 49), (104, 48), (96, 56), (97, 57), (105, 56), (104, 57) ] VALID_A1 = [chr(x) + chr(y) for x in xrange(97, 105) for y in xrange(49, 57)] INVALID...
Add test_is_coord_on_board() to assert the function returns True if the coordinate is on the board and False otherwise
Add test_is_coord_on_board() to assert the function returns True if the coordinate is on the board and False otherwise
Python
mit
EyuelAbebe/gamer,EyuelAbebe/gamer
0cecbabd2d594bfc2ca57e522658d13eda2bc6a8
pipdiff/pipdiff.py
pipdiff/pipdiff.py
#!/usr/bin/env python # Original author : Jonathan Zempel, https://github.com/jzempel # Copied from https://gist.github.com/jzempel/4624227 # Copied here for the purpose of adding it to PyPI from pkg_resources import parse_version from xmlrpclib import ServerProxy pypi = ServerProxy("http://pypi.python.org/pypi") d...
#!/usr/bin/env python # Original author : Jonathan Zempel, https://github.com/jzempel # Copied from https://gist.github.com/jzempel/4624227 # Copied here for the purpose of adding it to PyPI from pkg_resources import parse_version try: from xmlrpclib import ServerProxy except ImportError: import xmlrpc.client ...
Add support for Python 3
Add support for Python 3
Python
bsd-3-clause
ogt/pipdiff
8f4c5b6a4c609e5154dfee432c567e382f69ee88
src/geoserver/layer.py
src/geoserver/layer.py
from urllib2 import HTTPError from geoserver.support import atom_link, get_xml from geoserver.style import Style from geoserver.resource import FeatureType, Coverage class Layer: def __init__(self, node): self.name = node.find("name").text self.href = atom_link(node) self.update() def update(self): ...
from urllib2 import HTTPError from geoserver.support import ResourceInfo, atom_link, get_xml from geoserver.style import Style from geoserver.resource import FeatureType, Coverage class Layer(ResourceInfo): resource_type = "layers" def __init__(self, node): self.name = node.find("name").text self.href = ...
Update Layer to use ResourceInfo support class
Update Layer to use ResourceInfo support class
Python
mit
boundlessgeo/gsconfig,garnertb/gsconfig.py,Geode/gsconfig,cristianzamar/gsconfig,scottp-dpaw/gsconfig,afabiani/gsconfig
edf465bd80b20f151064ac39ba4d0c1cd9643e1d
stix2/test/v21/test_base.py
stix2/test/v21/test_base.py
import datetime as dt import json import pytest import pytz from stix2.base import STIXJSONEncoder def test_encode_json_datetime(): now = dt.datetime(2017, 3, 22, 0, 0, 0, tzinfo=pytz.UTC) test_dict = {'now': now} expected = '{"now": "2017-03-22T00:00:00Z"}' assert json.dumps(test_dict, cls=STIXJSO...
import datetime as dt import json import uuid import pytest import pytz import stix2 from stix2.base import STIXJSONEncoder def test_encode_json_datetime(): now = dt.datetime(2017, 3, 22, 0, 0, 0, tzinfo=pytz.UTC) test_dict = {'now': now} expected = '{"now": "2017-03-22T00:00:00Z"}' assert json.dum...
Add a unit test for deterministic ID, with unicode
Add a unit test for deterministic ID, with unicode
Python
bsd-3-clause
oasis-open/cti-python-stix2
a9a121d5fe595f54ed482ec162dc7a9703a65c13
tp/__init__.py
tp/__init__.py
__import__('pkg_resources').declare_namespace(__name__) try: import modulefinder for p in __path__: modulefinder.AddPackagePath(__name__, p) except Exception, e: import warnings warnings.warn(e, RuntimeWarning)
try: __import__('pkg_resources').declare_namespace(__name__) import modulefinder for p in __path__: modulefinder.AddPackagePath(__name__, p) except Exception, e: import warnings warnings.warn(e, RuntimeWarning)
Fix for people without setuptools.
Fix for people without setuptools.
Python
lgpl-2.1
thousandparsec/libtpproto-py,thousandparsec/libtpproto-py
1d07bcd8a953b477275175b754d054a584dcdbcf
redditcrawl.py
redditcrawl.py
#6y7LtOjoNEfe72g62kZfwtFHMWkQ8XsZvcQ8xZDe import praw outfile = open('temp.js', 'w') credentials = open('credentials', 'r') client_id = credentials.readline().strip(' \t\n\r') client_secret = credentials.readline().strip(' \t\n\r') startId = 466 reddit = praw.Reddit(client_id=client_id, client_secret=client_secre...
#6y7LtOjoNEfe72g62kZfwtFHMWkQ8XsZvcQ8xZDe import praw outfile = open('temp.js', 'w') credentials = open('credentials', 'r') client_id = credentials.readline().strip(' \t\n\r') client_secret = credentials.readline().strip(' \t\n\r') startId = 466 reddit = praw.Reddit(client_id=client_id, client_secret=client_secre...
Modify crawler to save name of user who contributed an entry
Modify crawler to save name of user who contributed an entry
Python
agpl-3.0
RolandR/place-atlas,RolandR/place-atlas,RolandR/place-atlas,RolandR/place-atlas
7ebadc3a1befa265dfc65e78dfbe98041b96d076
serial_com_test/raspberry_pi/test.py
serial_com_test/raspberry_pi/test.py
import serial import time # Define Constants SERIAL_DEVICE = "/dev/tty.usbmodem1421" # Establish Connection ser = serial.Serial(SERIAL_DEVICE, 9600) time.sleep(2) print("Connection Established"); # Send Data to Pi ser.write('h') time.sleep(5); ser.write('l')
import serial import time # Define Constants SERIAL_DEVICE = "/dev/ttyACM0" # Establish Connection ser = serial.Serial(SERIAL_DEVICE, 9600) time.sleep(2) print("Connection Established"); # Send Data to Pi ser.write('h') time.sleep(5); ser.write('l')
Update SERIAL_DEVICE to match the Raspberry Pi
Update SERIAL_DEVICE to match the Raspberry Pi
Python
mit
zacharylawrence/ENEE408I-Team-9,zacharylawrence/ENEE408I-Team-9,zacharylawrence/ENEE408I-Team-9
ba842af48c1d137584811d75d15c3b7ceddc2372
pychecker2/File.py
pychecker2/File.py
from pychecker2.util import type_filter from compiler import ast class File: def __init__(self, name): self.name = name self.parseTree = None self.scopes = {} self.root_scope = None self.warnings = [] def __cmp__(self, other): return cmp(self.name, other.name) ...
from pychecker2.util import parents from compiler import ast class File: def __init__(self, name): self.name = name self.parseTree = None self.scopes = {} self.root_scope = None self.warnings = [] def __cmp__(self, other): return cmp(self.name, other.name) ...
Add more ways to suck line numbers from nodes
Add more ways to suck line numbers from nodes
Python
bsd-3-clause
mitar/pychecker,mitar/pychecker
9ec35300975a141162749cba015cedbe900f97eb
idiotscript/Collector.py
idiotscript/Collector.py
class Collector(object): def __init__(self): self._groups = [] self._current_group = None def add_input(self, new_input): if self._current_group is None: self._current_group = [] self._current_group.append(new_input) def finalise_group(self): self._group...
class Collector(object): def __init__(self): self._groups = [] self._current_group = None def add_input(self, new_input): if self._current_group is None: self._current_group = [] self._groups.append(self._current_group) self._current_group.append(new_inpu...
Fix bug with collector losing last group of input
Fix bug with collector losing last group of input This means the script runner doesn't have to manually finalise the last input, which was always a bit silly. In fact, the whole metaphor is rather silly. I should change it to be "start new group" instead.
Python
unlicense
djmattyg007/IdiotScript
6d5e80771f04fe2aa7cb83c89bdb4e16178b219b
DB.py
DB.py
# Create a database import sqlite3 import csv from datetime import datetime import sys reload(sys) sys.setdefaultencoding('utf8') class createDB(): def readCSV(self, filename): try: conn = sqlite3.connect('databaseForTest.db') print 'DB Creation Successful!' cur = ...
# Create a database import sqlite3 import csv from datetime import datetime import sys reload(sys) sys.setdefaultencoding('utf8') class createDB(): def readCSV(self, filename): try: conn = sqlite3.connect('databaseForTest.db') print 'DB Creation Successful!' cur = ...
Drop existing products table before creation
Drop existing products table before creation
Python
mit
joykuotw/python-endpoints,joykuotw/python-endpoints,joykuotw/python-endpoints
8e0afc06d221d86677a172fdb7d1388225504ba6
resp/__main__.py
resp/__main__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import argparse from Parser import Parser def main(argv): # Arguments: parser = argparse.ArgumentParser() parser.add_argument('-r', '--redis_cmd', type=str, default='') parser.add_argument('-i', '--input', type=str, default='') parser.add...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse from Parser import Parser def main(): # Arguments: parser = argparse.ArgumentParser() parser.add_argument('-r', '--redis_cmd', type=str, default='', required=True) parser.add_argument('-i', '--input', type=str, default='', required=False...
Add specific required-property to all arguments
Add specific required-property to all arguments
Python
mit
nok/resp,nok/resp
8e603328ff08888a1236e6b8ca0adbeb8bae819b
ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/logic.py
ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/logic.py
from ckan.plugins import toolkit as tk import model import ckan.model as ckan_model def service_permission_application_create(context, data_dict): tk.check_access('service_permission_application_create', context, data_dict) organization = data_dict.get('organization') vat_id = data_dict.get('vat_id') ...
from ckan.plugins import toolkit as tk import model _ = tk._ def service_permission_application_create(context, data_dict): tk.check_access('service_permission_application_create', context, data_dict) errors = {} error_summary = {} organization = data_dict.get('organization') if organization is...
Add validation to api for missing required values
LIKA-106: Add validation to api for missing required values
Python
mit
vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog
56441d42ed87e2adad8b36c25cf695b0747a8c16
tests/djworkflows/models.py
tests/djworkflows/models.py
from django.db import models as djmodels import xworkflows from django_xworkflows import models class MyWorkflow(xworkflows.Workflow): states = ('foo', 'bar', 'baz') transitions = ( ('foobar', 'foo', 'bar'), ('gobaz', ('foo', 'bar'), 'baz'), ('bazbar', 'baz', 'bar'), ) initial_...
from django.db import models as djmodels from django_xworkflows import models class MyWorkflow(models.Workflow): states = ('foo', 'bar', 'baz') transitions = ( ('foobar', 'foo', 'bar'), ('gobaz', ('foo', 'bar'), 'baz'), ('bazbar', 'baz', 'bar'), ) initial_state = 'foo' class ...
Use imports from django_xworkflows instead of imports from xworkflows in tests
Use imports from django_xworkflows instead of imports from xworkflows in tests Signed-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polyconseil.fr>
Python
bsd-2-clause
rbarrois/django_xworkflows
83a16ba4485f3e483adc20352cb0cef7c02f8ef2
tests/test_config_schema.py
tests/test_config_schema.py
from __future__ import unicode_literals, division, absolute_import import jsonschema from flexget import config_schema from flexget import plugin from tests import FlexGetBase class TestSchemaValidator(FlexGetBase): def test_plugin_schemas_are_valid(self): for p in plugin.plugins.values(): i...
from __future__ import unicode_literals, division, absolute_import import jsonschema from flexget import config_schema from tests import FlexGetBase class TestSchemaValidator(FlexGetBase): def test_registered_schemas_are_valid(self): for path in config_schema.schema_paths: schema = config_sc...
Convert unit test to test all registered schemas instead of plugins directly.
Convert unit test to test all registered schemas instead of plugins directly.
Python
mit
vfrc2/Flexget,poulpito/Flexget,jacobmetrick/Flexget,ibrahimkarahan/Flexget,Danfocus/Flexget,oxc/Flexget,ibrahimkarahan/Flexget,asm0dey/Flexget,qvazzler/Flexget,dsemi/Flexget,crawln45/Flexget,thalamus/Flexget,tsnoam/Flexget,patsissons/Flexget,tsnoam/Flexget,vfrc2/Flexget,Danfocus/Flexget,drwyrm/Flexget,v17al/Flexget,grr...
bc071a524d1695e6d95b42709442dddaf4185cd9
account_invoice_start_end_dates/__manifest__.py
account_invoice_start_end_dates/__manifest__.py
# Copyright 2016-2019 Akretion France # Copyright 2018-2019 Camptocamp # @author: Alexis de Lattre <alexis.delattre@akretion.com> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Invoice Start End Dates", "version": "13.0.1.0.0", "category": "Accounting & Finance", "li...
# Copyright 2016-2019 Akretion France # Copyright 2018-2019 Camptocamp # @author: Alexis de Lattre <alexis.delattre@akretion.com> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Invoice Start End Dates", "version": "13.0.1.0.0", "category": "Accounting & Finance", "li...
FIX visibility of forecast button
FIX visibility of forecast button Default value for cutoff date is end date of previous fiscal year
Python
agpl-3.0
OCA/account-closing,OCA/account-closing
f8dd1fd8ee899c0147a9a88149097e9b7cd68f01
tests/generic_views/views.py
tests/generic_views/views.py
from django.views.generic.edit import CreateView from templated_email.generic_views import TemplatedEmailFormViewMixin from tests.generic_views.models import Author # This view send a welcome email to the author class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView): model = Author fields = ['name',...
from django.views.generic.edit import CreateView from templated_email.generic_views import TemplatedEmailFormViewMixin from tests.generic_views.models import Author # This view send a welcome email to the author class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView): model = Author fields = ['name',...
Remove unecessary attribute from test
Remove unecessary attribute from test
Python
mit
BradWhittington/django-templated-email,BradWhittington/django-templated-email,vintasoftware/django-templated-email,vintasoftware/django-templated-email
05ba498867ff16c4221dcd758d5cdef9ee884b27
modules/test_gitdata.py
modules/test_gitdata.py
from nose import with_setup from nose.tools import * import os import sys from gitdata import GitData import simplejson as json def test_fetch(): gd = GitData(repo="./treenexus") study_id = 438 study_nexson = gd.fetch_study(study_id) valid = 1 try: json.loads(study_nexson) except...
import unittest import os import sys from gitdata import GitData import simplejson as json class TestGitData(unittest.TestCase): def test_fetch(self): gd = GitData(repo="./treenexus") study_id = 438 study_nexson = gd.fetch_study(study_id) valid = 1 try: json.loa...
Convert GitData tests to a unittest suite
Convert GitData tests to a unittest suite
Python
bsd-2-clause
OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api
a05372ad910900ec2ef89bb10d4a0759c9bcd437
app.py
app.py
import os from flask import Flask, request, redirect, session import twilio.twiml from twilio.rest import TwilioRestClient from charity import Charity SECRET_KEY = os.environ['DONATION_SECRET_KEY'] app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello(): from_number = request.values.get('From'...
import os from flask import Flask, request import twilio.twiml from twilio.rest import TwilioRestClient app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello(): from_number = request.args.get('From') text_content = request.args.get('Body').lower() client = TwilioRestClient(os.environ...
Test sending a fresh message
Test sending a fresh message
Python
mit
DanielleSucher/Text-Donation
94e0e31a8329cbbdc1545fa5c12b04600422627f
main.py
main.py
# Must be named "plugins_" # because sublime_plugin claims a plugin module's `plugin` attribute for itself. from .plugins_ import * # noqa
try: from package_control import events except ImportError: pass else: if events.post_upgrade(__package__): # clean up sys.modules to ensure all submodules are reloaded import sys modules_to_clear = set() for module_name in sys.modules: if module_name.startswith(_...
Add code to remove cached sub-modules on upgrade
Add code to remove cached sub-modules on upgrade This is untested because I'm too lazy to simulate a package updating situation, but I generally believe it should work. It shouldn't break anything, at least.
Python
mit
SublimeText/AAAPackageDev,SublimeText/PackageDev,SublimeText/AAAPackageDev
35a2e4ecfc7c39ca477279a49d1a49bb4395b7ad
main.py
main.py
"""Usage: chronicler [-c CHRONICLE] The Chronicler remembers… Options: -c, --chronicle CHRONICLE chronicle file to use [default: chronicle.hjson] """ import docopt import hjson import jsonschema import chronicle def main(): options = docopt.docopt(__doc__) try: c = open(options['--chronicle'...
"""Usage: chronicler [-c CHRONICLE] The Chronicler remembers… Options: -c, --chronicle CHRONICLE chronicle file to use [default: chronicle.hjson] """ import docopt import hjson import jsonschema import chronicle def main(): options = docopt.docopt(__doc__) try: c = open(options['--chronicle'...
Make a better error message for ValidationError
Make a better error message for ValidationError
Python
unlicense
elwinar/chronicler
968274deace1aa16d45df350c437eab699d02b16
byceps/services/brand/transfer/models.py
byceps/services/brand/transfer/models.py
""" byceps.services.brand.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from dataclasses import dataclass from ....typing import BrandID @dataclass(frozen=True) class Brand: id: BrandID title: str im...
""" byceps.services.brand.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from dataclasses import dataclass from typing import Optional from ....typing import BrandID @dataclass(frozen=True) class Brand: id: B...
Fix type hints of brand DTO image fields
Fix type hints of brand DTO image fields
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
c6917a2f439b99078e67310230f1d0cfa0de8a7b
tests/builder_tests.py
tests/builder_tests.py
import ujson import unittest from sqlalchemy import Column, Integer, String, create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.pool import NullPool from interrogate import Builder class InterrogateTestCase(unittest.TestCase): def valid_b...
import ujson import unittest from sqlalchemy import Column, Integer, String, create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from interrogate import Builder class InterrogateTestCase(unittest.TestCase): def valid_builder_args(self): model = se...
Add test helper for creating users
Add test helper for creating users
Python
mit
numberoverzero/jsonquery
0b741c89ea19759f25526256ee039707cb423cef
aldryn_faq/tests/test_menu.py
aldryn_faq/tests/test_menu.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from aldryn_faq.menu import FaqCategoryMenu from django.utils.translation import ( get_language_from_request, ) from .test_base import AldrynFaqTest, CMSRequestBasedTest class TestMenu(AldrynFaqTest, CMSRequestBasedTest): def test_get_nodes(se...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from aldryn_faq.menu import FaqCategoryMenu from .test_base import AldrynFaqTest, CMSRequestBasedTest class TestMenu(AldrynFaqTest, CMSRequestBasedTest): def test_get_nodes(self): # Test that the EN version of the menu has only category1 ...
Fix tests to now include the questions, which are now in the menu
Fix tests to now include the questions, which are now in the menu
Python
bsd-3-clause
czpython/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq
57dfe42d957214d23e1ad28595db5af5adf1a5d6
Orange/regression/__init__.py
Orange/regression/__init__.py
from .base_regression import (ModelRegression as Model, LearnerRegression as Learner, SklModelRegression as SklModel, SklLearnerRegression as SklLearner) from .linear import * from .mean import * from .knn import * from .simple_ra...
from .base_regression import (ModelRegression as Model, LearnerRegression as Learner, SklModelRegression as SklModel, SklLearnerRegression as SklLearner) from .linear import * from .mean import * from .knn import * from .simple_ra...
Include simple tree in regression package
SimpleTree: Include simple tree in regression package
Python
bsd-2-clause
qPCR4vir/orange3,marinkaz/orange3,qPCR4vir/orange3,kwikadi/orange3,cheral/orange3,marinkaz/orange3,cheral/orange3,qPCR4vir/orange3,kwikadi/orange3,cheral/orange3,kwikadi/orange3,kwikadi/orange3,marinkaz/orange3,cheral/orange3,cheral/orange3,kwikadi/orange3,qPCR4vir/orange3,qPCR4vir/orange3,qPCR4vir/orange3,kwikadi/oran...
518df76dcc14895f4555451194f64a98ccc814ef
pymco/utils.py
pymco/utils.py
""" :py:mod:`pymco.utils` --------------------- python-mcollective utils. """ def import_class(import_path): """Import a class based on given dotted import path string. It just splits the import path in order to geth the module and class names, then it just calls to :py:func:`__import__` with the module ...
""" :py:mod:`pymco.utils` --------------------- python-mcollective utils. """ import importlib def import_class(import_path): """Import a class based on given dotted import path string. It just splits the import path in order to geth the module and class names, then it just calls to :py:func:`__import__`...
Use importlib.import_module instead of __import__
Use importlib.import_module instead of __import__
Python
bsd-3-clause
rafaduran/python-mcollective,rafaduran/python-mcollective,rafaduran/python-mcollective,rafaduran/python-mcollective
4fe72ff427290e845c0259cd1aadf21dd29b9872
kivy/tests/test_video.py
kivy/tests/test_video.py
import unittest class AnimationTestCase(unittest.TestCase): def test_video_unload(self): # fix issue https://github.com/kivy/kivy/issues/2275 # AttributeError: 'NoneType' object has no attribute 'texture' from kivy.uix.video import Video from kivy.clock import Clock from ...
import unittest class AnimationTestCase(unittest.TestCase): def test_video_unload(self): # fix issue https://github.com/kivy/kivy/issues/2275 # AttributeError: 'NoneType' object has no attribute 'texture' from kivy.uix.video import Video from kivy.clock import Clock from ...
Fix path and avi -> mpg.
Fix path and avi -> mpg.
Python
mit
el-ethan/kivy,angryrancor/kivy,janssen/kivy,rafalo1333/kivy,cbenhagen/kivy,inclement/kivy,Farkal/kivy,jffernandez/kivy,manthansharma/kivy,youprofit/kivy,darkopevec/kivy,jegger/kivy,xiaoyanit/kivy,bob-the-hamster/kivy,Cheaterman/kivy,manthansharma/kivy,LogicalDash/kivy,aron-bordin/kivy,vipulroxx/kivy,andnovar/kivy,iamut...
0728a5b64ec9a871267d3b0b6ea6c3390b7a8e1f
clowder/clowder/cli/status_controller.py
clowder/clowder/cli/status_controller.py
from cement.ext.ext_argparse import expose from clowder.cli.abstract_base_controller import AbstractBaseController class StatusController(AbstractBaseController): class Meta: label = 'status' stacked_on = 'base' stacked_type = 'nested' description = 'Print project status' ...
from cement.ext.ext_argparse import expose import clowder.util.formatting as fmt from clowder.cli.abstract_base_controller import AbstractBaseController from clowder.commands.util import run_group_command from clowder.util.decorators import network_connection_required class StatusController(AbstractBaseController): ...
Add `clowder status` logic to Cement controller
Add `clowder status` logic to Cement controller
Python
mit
JrGoodle/clowder,JrGoodle/clowder,JrGoodle/clowder
56c5ba27ecb4324e4c137e9e1595f95ffd58b73a
lesscpy/plib/deferred.py
lesscpy/plib/deferred.py
# -*- coding: utf8 -*- """ .. module:: lesscpy.plib.deferred :synopsis: Deferred mixin call. Copyright (c) See LICENSE for details. .. moduleauthor:: Jóhann T. Maríusson <jtm@robot.is> """ from .node import Node class Deferred(Node): def __init__(self, mixin, args): """This node represents...
# -*- coding: utf8 -*- """ .. module:: lesscpy.plib.deferred :synopsis: Deferred mixin call. Copyright (c) See LICENSE for details. .. moduleauthor:: Jóhann T. Maríusson <jtm@robot.is> """ from .node import Node class Deferred(Node): def __init__(self, mixin, args): """This node represents...
Add post process stage for stray mixin calls
Add post process stage for stray mixin calls
Python
mit
joequery/lesscpy,lesscpy/lesscpy,robotis/lesscpy,fivethreeo/lesscpy
b5454286a2cfce07f4971b7bc56dd131402f8fe3
iati/__init__.py
iati/__init__.py
"""A top-level namespace package for IATI.""" __import__('pkg_resources').declare_namespace(__name__) from .codelists import Code, Codelist # noqa: F401 from .data import Dataset # noqa: F401 from .rulesets import Rule, Ruleset # noqa: F401 from .rulesets import RuleAtLeastOne, RuleDateOrder, RuleDependent, RuleNoM...
"""A top-level namespace package for IATI.""" from .codelists import Code, Codelist # noqa: F401 from .data import Dataset # noqa: F401 from .rulesets import Rule, Ruleset # noqa: F401 from .rulesets import RuleAtLeastOne, RuleDateOrder, RuleDependent, RuleNoMoreThanOne, RuleRegexMatches, RuleRegexNoMatches, RuleSta...
Fix pylint error after iati.core -> iati
Fix pylint error after iati.core -> iati
Python
mit
IATI/iati.core,IATI/iati.core
08a2220bdacb3e49050a7c223e5c1d8109ae434f
ipython-magic.py
ipython-magic.py
#################################### # This file was created by Bohrium. # It allows you to run NumPy code (cells) as Bohrium, by using the magic command # `%%bohrium` in your cells, e.g.: # # %%bohrium # print(numpy) # print(numpy.arange(10)) #################################### from IPython.core.magic import...
#################################### # This file was created by Bohrium. # It allows you to run NumPy code (cells) as Bohrium, by using the magic command # `%%bohrium` in your cells, e.g.: # # %%bohrium # print(numpy) # print(numpy.arange(10)) #################################### from IPython.core.magic import...
Disable the effect of %%bohrium if bohrium cannot be imported.
Disable the effect of %%bohrium if bohrium cannot be imported. The first time the user attempts to use %%bohrium a warning will be shown. From this point onwards all %%bohrium statements will have no effect silently.
Python
apache-2.0
bh107/bohrium,madsbk/bohrium,madsbk/bohrium,bh107/bohrium,bh107/bohrium,bh107/bohrium,madsbk/bohrium,madsbk/bohrium
c2fb467626d586bfb5ddef60fd4d1447515ad161
fpsd/evaluation.py
fpsd/evaluation.py
def get_feature_importances(model): try: return model.feature_importances_ except: pass try: # Must be 1D for feature importance plot if len(model.coef_) <= 1: return model.coef_[0] else: return model.coef_ except: pass return ...
def get_feature_importances(model): try: return model.feature_importances_ except: pass try: # Must be 1D for feature importance plot if len(model.coef_) <= 1: return model.coef_[0] else: return model.coef_ except: pass return ...
Add function for plotting feature importances
Add function for plotting feature importances
Python
agpl-3.0
freedomofpress/fingerprint-securedrop,freedomofpress/FingerprintSecureDrop,freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop,freedomofpress/FingerprintSecureDrop
1ac105b7efa3ae4c531fdcc8a626ab47d86e0192
tests/test_gen_schema_reading_and_writing.py
tests/test_gen_schema_reading_and_writing.py
# -*- coding: utf-8 -*- """ Test parsing genfiles and writing GenSchema to genfiles. Created on Sun Jul 10 19:54:47 2016 @author: Aaron Beckett """ import pytest from ctip import GenSchema def gather_test_files(): """Search the tests/resources directory for pairs of gen and config files.""" pass @pytes...
# -*- coding: utf-8 -*- """ Test parsing genfiles and writing GenSchema to genfiles. Created on Sun Jul 10 19:54:47 2016 @author: Aaron Beckett """ import pytest import json from ctip import GenSchema def gather_test_files(): """Search the tests/resources directory for pairs of gen and config files.""" ...
Write parameterized test for gen schema read function.
Write parameterized test for gen schema read function.
Python
mit
becketta/ctip
78d520b88e13a35ac20a0eeea1385f35b17383d2
sieve/sieve.py
sieve/sieve.py
def sieve(n): return list(primes(n)) def primes(n): if n < 2: raise StopIteration yield 2 not_prime = set() for i in range(3, n+1, 2): if i not in not_prime: yield i not_prime.update(range(i*i, n, i))
def sieve(n): if n < 2: return [] not_prime = set() prime = [2] for i in range(3, n+1, 2): if i not in not_prime: prime.append(i) not_prime.update(range(i*i, n, i)) return prime
Switch to more optimal non-generator solution
Switch to more optimal non-generator solution
Python
agpl-3.0
CubicComet/exercism-python-solutions
9cb249fc2f7bc1043d50f7d9424026a3a68e4f2a
python/ql/test/query-tests/Security/CWE-295-RequestWithoutValidation/make_request.py
python/ql/test/query-tests/Security/CWE-295-RequestWithoutValidation/make_request.py
import requests #Simple cases requests.get('https://semmle.com', verify=True) # GOOD requests.get('https://semmle.com', verify=False) # BAD requests.post('https://semmle.com', verify=True) # GOOD requests.post('https://semmle.com', verify=False) # BAD # Simple flow put = requests.put put('https://semmle.com', verify=...
import requests #Simple cases requests.get('https://semmle.com', verify=True) # GOOD requests.get('https://semmle.com', verify=False) # BAD requests.post('https://semmle.com', verify=True) # GOOD requests.post('https://semmle.com', verify=False) # BAD # Simple flow put = requests.put put('https://semmle.com', verify=...
Add test we don't handle for `py/request-without-cert-validation`
Python: Add test we don't handle for `py/request-without-cert-validation`
Python
mit
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
55f8bce3a4d1232f2b7ffbdfa2c1cf741686a33f
lots/migrations/0002_auto_20170717_2115.py
lots/migrations/0002_auto_20170717_2115.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-18 02:15 from __future__ import unicode_literals from django.db import models, migrations from lots.models import LotType, Lot from revenue.models import Fee, Receipt def load_data(apps, schema_editor): LotType = apps.get_model("lots", "LotType") ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-18 02:15 from __future__ import unicode_literals from django.db import models, migrations, connection from lots.models import LotType, Lot from revenue.models import Fee, Receipt def load_data(apps, schema_editor): LotType = apps.get_model("lots", ...
Make reverse migration for lot_type run
Make reverse migration for lot_type run
Python
mpl-2.0
jackbravo/condorest-django,jackbravo/condorest-django,jackbravo/condorest-django
9ffe8a195af0a2504728e4764d093152959474e8
mrp_product_variants/models/procurement.py
mrp_product_variants/models/procurement.py
# -*- coding: utf-8 -*- # © 2015 Oihane Crucelaegui - AvanzOSC # © 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import api, models class ProcurementOrder(models.Model): _inherit = 'procurement.order' @api.model def _prepare...
# -*- coding: utf-8 -*- # © 2015 Oihane Crucelaegui - AvanzOSC # © 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import api, models class ProcurementOrder(models.Model): _inherit = 'procurement.order' @api.model def _prepare...
Fix MTO configurator not filled
[FIX] mrp_product_variants: Fix MTO configurator not filled
Python
agpl-3.0
Eficent/odoomrp-wip,oihane/odoomrp-wip,odoomrp/odoomrp-wip,jobiols/odoomrp-wip,esthermm/odoomrp-wip,esthermm/odoomrp-wip,Eficent/odoomrp-wip,jobiols/odoomrp-wip,Daniel-CA/odoomrp-wip-public,diagramsoftware/odoomrp-wip,diagramsoftware/odoomrp-wip,sergiocorato/odoomrp-wip,sergiocorato/odoomrp-wip,factorlibre/odoomrp-wip,...