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
d59f3259875ffac49668ffb3ce34ca511385ebb7
rated/settings.py
rated/settings.py
from django.conf import settings DEFAULT_REALM = getattr(settings, 'RATED_DEFAULT_REALM', 'default') DEFAULT_LIMIT = getattr(settings, 'RATED_DEFAULT_LIMIT', 100) DEFAULT_DURATION = getattr(settings, 'RATED_DEFAULT_DURATION', 60 * 60) RESPONSE_CODE = getattr(settings, 'RATED_RESPONSE_CODE', 429) RESPONSE_MESSAGE = g...
from django.conf import settings DEFAULT_REALM = getattr(settings, 'RATED_DEFAULT_REALM', 'default') DEFAULT_LIMIT = getattr(settings, 'RATED_DEFAULT_LIMIT', 100) DEFAULT_DURATION = getattr(settings, 'RATED_DEFAULT_DURATION', 60 * 60) RESPONSE_CODE = getattr(settings, 'RATED_RESPONSE_CODE', 429) RESPONSE_MESSAGE = g...
Fix USE_X_FORWARDED_FOR for proxied environments
Fix USE_X_FORWARDED_FOR for proxied environments The settings for USE_X_FORWARDED_FOR were not being respected because the settings were not being passed through.
Python
bsd-3-clause
funkybob/django-rated
c1ae43fd33cd0f8eb3e270907a8ed7e728d1e268
server.py
server.py
import evdev import requests import json import datetime import yaml def main(): config = load_config() dev = evdev.InputDevice(config['device_path']) output_line('Initialized - Capturing device: ' + str(dev)) for event in dev.read_loop(): if event.type == evdev.ecodes.EV_KEY: event = evdev.categor...
import evdev import requests import json import datetime import yaml def main(): config = load_config() dev = evdev.InputDevice(config['device_path']) output_line('Initialized - Capturing device: ' + str(dev)) for event in dev.read_loop(): if event.type == evdev.ecodes.EV_KEY: output_line(event) ...
Add captured_at timestamp to POST payload
Add captured_at timestamp to POST payload Timestamp is in ISO 8601 format
Python
mit
nicolas-fricke/keypost
4c5550420b8a9f1bf88f4329952f6e2a161cd20f
test/test_panels/test_navigation.py
test/test_panels/test_navigation.py
from pyqode.core.api import TextHelper from pyqode.qt.QtTest import QTest def test_toggle_button(editor): editor.file.open('test/files/example.json') editor.show() TextHelper(editor).goto_line(6) QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 ...
from pyqode.core.api import TextHelper from pyqode.qt.QtTest import QTest def test_toggle_button(editor): editor.file.open('test/files/example.json') editor.show() TextHelper(editor).goto_line(6) QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 ...
Fix test on kaos with latest qt5
Fix test on kaos with latest qt5
Python
mit
pyQode/pyqode.json,pyQode/pyqode.json
8e6662a4aaf654ddf18c1c4e733c58db5b9b5579
opps/channels/context_processors.py
opps/channels/context_processors.py
# -*- coding: utf-8 -*- from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site from .models import Channel def channel_context(request): """ Channel context processors """ site = get_current_site(request) opps_menu = Channel.objects...
# -*- coding: utf-8 -*- from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site from django.core.cache import cache from .models import Channel def channel_context(request): """ Channel context processors """ site = get_current_site(requ...
Add cache in opps menu list via context processors
Add cache in opps menu list via context processors
Python
mit
YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps
7060f48df582dcfae1768cc37d00a25e0e2e1f6f
app/views/comment_view.py
app/views/comment_view.py
from flask import jsonify from flask_classy import FlaskView from flask_user import current_user, login_required from ..models import CommentModel, PostModel from ..forms import CommentForm class Comment(FlaskView): def get(self): pass def all(self, post_id): comment = CommentModel() ...
from flask import jsonify from flask_classy import FlaskView from flask_user import current_user, login_required from ..models import CommentModel, PostModel from ..forms import CommentForm class Comment(FlaskView): def get(self): pass def all(self, post_id): comment = CommentModel() ...
Comment post endpoint return a ksopn, fix issue saving comments add post id and convert it to int
Comment post endpoint return a ksopn, fix issue saving comments add post id and convert it to int
Python
mit
oldani/nanodegree-blog,oldani/nanodegree-blog,oldani/nanodegree-blog
2b3281863f11fa577dd6504e58f6faec8ada2259
qiime_studio/api/v1.py
qiime_studio/api/v1.py
from flask import Blueprint, jsonify from .security import validate_request_authentication from qiime.sdk import PluginManager PLUGIN_MANAGER = PluginManager() v1 = Blueprint('v1', __name__) v1.before_request(validate_request_authentication) @v1.route('/', methods=['GET', 'POST']) def root(): return jsonify(con...
from flask import Blueprint, jsonify from .security import validate_request_authentication from qiime.sdk import PluginManager PLUGIN_MANAGER = PluginManager() v1 = Blueprint('v1', __name__) v1.before_request(validate_request_authentication) @v1.route('/', methods=['GET', 'POST']) def root(): return jsonify(con...
Change order of API call
Change order of API call
Python
bsd-3-clause
jakereps/qiime-studio-frontend,jakereps/qiime-studio,qiime2/qiime-studio,qiime2/qiime-studio,jakereps/qiime-studio,qiime2/qiime-studio-frontend,qiime2/qiime-studio-frontend,qiime2/qiime-studio,jakereps/qiime-studio,jakereps/qiime-studio-frontend
e1a7e4535e64c005fb508ba6d3fed021bbd40a62
oedb_datamodels/versions/1a73867b1e79_add_meta_search.py
oedb_datamodels/versions/1a73867b1e79_add_meta_search.py
"""Add meta_search table Revision ID: 1a73867b1e79 Revises: 1c6e2fb3d3b6 Create Date: 2019-04-29 11:47:04.783168 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql from sqlalchemy.orm.session import sessionmaker from api.actions import update_meta_search # revision identif...
"""Add meta_search table Revision ID: 1a73867b1e79 Revises: 1c6e2fb3d3b6 Create Date: 2019-04-29 11:47:04.783168 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql from sqlalchemy.orm.session import sessionmaker from api.actions import update_meta_search from dataedit.views...
Update only tables in visible schemas
Update only tables in visible schemas
Python
agpl-3.0
openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform
7eb10376b585e56faad4672959f6654f2500a38d
astropy/units/__init__.py
astropy/units/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for defining and converting between different physical units. This code is adapted from the `pynbody <http://code.google.com/p/pynbody/>`_ units module written by Andrew Pontzen, who has granted the Astr...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for defining and converting between different physical units. This code is adapted from the `pynbody <http://code.google.com/p/pynbody/>`_ units module written by Andrew Pontzen, who has granted the Astr...
Add `one` as shortcut to `dimensionless_unscaled`
Add `one` as shortcut to `dimensionless_unscaled` I find creating dimensionless `Quantity`es overly painful compared to quantities with dimensions. Currently the two existing options are: 1. Putting `u.km`, `u.s` next to `u.dimensionless_unscaled`. Too large. 2. Putting `u.km`, `u.s` next to `u.Unit('')` or `u.Uni...
Python
bsd-3-clause
kelle/astropy,aleksandr-bakanov/astropy,bsipocz/astropy,kelle/astropy,mhvk/astropy,funbaker/astropy,larrybradley/astropy,MSeifert04/astropy,aleksandr-bakanov/astropy,saimn/astropy,DougBurke/astropy,AustereCuriosity/astropy,AustereCuriosity/astropy,StuartLittlefair/astropy,astropy/astropy,lpsinger/astropy,AustereCuriosi...
8a9fa06c36a89e3fde93059cfbe827506d5b8b62
orchard/errors/e500.py
orchard/errors/e500.py
# -*- coding: utf-8 -*- """ This module sets up the view for handling ``500 Internal Server Error`` errors. """ import datetime import flask import flask_classful from orchard.errors import blueprint class Error500View(flask_classful.FlaskView): """ View for ``500 Internal Server Error`` errors. ...
# -*- coding: utf-8 -*- """ This module sets up the view for handling ``500 Internal Server Error`` errors. """ import datetime import flask import flask_classful from orchard.errors import blueprint class Error500View(flask_classful.FlaskView): """ View for ``500 Internal Server Error`` errors. ...
Disable exception logging of status code 500 during testing.
Disable exception logging of status code 500 during testing.
Python
mit
BMeu/Orchard,BMeu/Orchard
6edd4114c4e715a3a0c440af455fff089a099620
scrapy/squeues.py
scrapy/squeues.py
""" Scheduler queues """ import marshal from six.moves import cPickle as pickle from queuelib import queue def _serializable_queue(queue_class, serialize, deserialize): class SerializableQueue(queue_class): def push(self, obj): s = serialize(obj) super(SerializableQueue, self).p...
""" Scheduler queues """ import marshal from six.moves import cPickle as pickle from queuelib import queue def _serializable_queue(queue_class, serialize, deserialize): class SerializableQueue(queue_class): def push(self, obj): s = serialize(obj) super(SerializableQueue, self).p...
Clarify comment about Pyhton versions
Clarify comment about Pyhton versions
Python
bsd-3-clause
pablohoffman/scrapy,pawelmhm/scrapy,finfish/scrapy,Ryezhang/scrapy,ssteo/scrapy,pawelmhm/scrapy,ssteo/scrapy,scrapy/scrapy,pawelmhm/scrapy,starrify/scrapy,ArturGaspar/scrapy,ssteo/scrapy,wujuguang/scrapy,dangra/scrapy,pablohoffman/scrapy,dangra/scrapy,elacuesta/scrapy,starrify/scrapy,scrapy/scrapy,kmike/scrapy,pablohof...
65c6c0b5ac47caac71c6c1284d84c1004d348c01
partner_relations/model/__init__.py
partner_relations/model/__init__.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2013 Therp BV (<http://therp.nl>). # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2013 Therp BV (<http://therp.nl>). # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
Fix imports at top of file.
Fix imports at top of file.
Python
agpl-3.0
Therp/partner-contact,acsone/partner-contact,open-synergy/partner-contact,diagramsoftware/partner-contact
92febbffb91943f13cfac8c00e55103b20645b70
plex/objects/library/container.py
plex/objects/library/container.py
from plex.objects.core.base import Property from plex.objects.container import Container from plex.objects.library.section import Section class MediaContainer(Container): section = Property(resolver=lambda: MediaContainer.construct_section) title1 = Property title2 = Property identifier = Property ...
from plex.objects.core.base import Property from plex.objects.container import Container from plex.objects.library.section import Section class MediaContainer(Container): section = Property(resolver=lambda: MediaContainer.construct_section) title1 = Property title2 = Property identifier = Property ...
Update [MediaContainer] children with the correct `section` object
Update [MediaContainer] children with the correct `section` object
Python
mit
fuzeman/plex.py
35293cecc99a629b3a185e69cf9ed3a339d9d1cf
automat/_introspection.py
automat/_introspection.py
""" Python introspection helpers. """ from types import CodeType as code, FunctionType as function def copycode(template, changes): if hasattr(code, "replace"): return template.replace(**{"co_" + k : v for k, v in changes.items()}) else: names = [ "argcount", "nlocals", "stacksize...
""" Python introspection helpers. """ from types import CodeType as code, FunctionType as function def copycode(template, changes): if hasattr(code, "replace"): return template.replace(**{"co_" + k : v for k, v in changes.items()}) names = [ "argcount", "nlocals", "stacksize", "flags", "code"...
Remove indentation level for easier review
Remove indentation level for easier review
Python
mit
glyph/automat
06cb55639d2bc504d0ec1b9fb073c40e00751328
doc/sample_code/demo_plot_state.py
doc/sample_code/demo_plot_state.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from pyogi.board import Board from pyogi.plot import plot_board if __name__ == '__main__': board = Board() board.set_initial_state() board.players = ['先手', '後手'] board.move('+7776FU') board.move('-3334FU') board.move('+2868HI') board.move('...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from pyogi.board import Board from pyogi.plot import plot_board if __name__ == '__main__': board = Board() board.set_initial_state() board.players = ['先手', '後手'] board.move('+7776FU') board.move('-3334FU') board.move('+2868HI') bo...
Disable output example_pic.png if exists
Disable output example_pic.png if exists
Python
mit
tosh1ki/pyogi,tosh1ki/pyogi
7f113399e4277ecbbfdde41d683c22082f7e19bd
scrapi/harvesters/smithsonian.py
scrapi/harvesters/smithsonian.py
''' Harvester for the Smithsonian Digital Repository for the SHARE project Example API call: http://repository.si.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class SiHarvester(OAIHarvester): short_name = 'smithsonian' ...
''' Harvester for the Smithsonian Digital Repository for the SHARE project Example API call: http://repository.si.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals import re from scrapi.base import helpers from scrapi.base import OAIHarvester class SiHarvester(OAIHa...
Add DOI parsing to identifiers
Add DOI parsing to identifiers
Python
apache-2.0
CenterForOpenScience/scrapi,alexgarciac/scrapi,jeffreyliu3230/scrapi,felliott/scrapi,fabianvf/scrapi,mehanig/scrapi,mehanig/scrapi,fabianvf/scrapi,erinspace/scrapi,erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi
3f90d0ec25491eb64f164180139d4baf9ff238a9
libravatar/context_processors.py
libravatar/context_processors.py
# Copyright (C) 2010 Jonathan Harker <jon@jon.geek.nz> # # This file is part of Libravatar # # Libravatar is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your...
# Copyright (C) 2010 Jonathan Harker <jon@jon.geek.nz> # # This file is part of Libravatar # # Libravatar is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your...
Sort the context list in alphabetical order
Sort the context list in alphabetical order
Python
agpl-3.0
libravatar/libravatar,libravatar/libravatar,libravatar/libravatar,libravatar/libravatar,libravatar/libravatar,libravatar/libravatar,libravatar/libravatar
5a682fccfb6d8e6db3eb100262cf628bfc10e829
categories/serializers.py
categories/serializers.py
from .models import Category, Keyword from rest_framework import serializers class CategorySerializer(serializers.ModelSerializer): class Meta(object): model = Category fields = ('pk', 'name', 'weight', 'comment_required') class KeywordSerializer(serializers.ModelSerializer): clas...
from .models import Category, Keyword from rest_framework import serializers class CategorySerializer(serializers.ModelSerializer): class Meta(object): model = Category fields = ('pk', 'name', 'comment_required') class KeywordSerializer(serializers.ModelSerializer): class Meta(obj...
Remove weight from category serializer
Remove weight from category serializer
Python
apache-2.0
belatrix/BackendAllStars
2b7bdf39497809749c504d10399dffabe52e97ca
testutils/base_server.py
testutils/base_server.py
from testrunner import testhelp class BaseServer(object): "Base server class. Responsible with setting up the ports etc." # We only want standalone repositories to have SSL support added via # useSSL sslEnabled = False def start(self, resetDir = True): raise NotImplementedError def cl...
from testrunner import testhelp class BaseServer(object): "Base server class. Responsible with setting up the ports etc." # We only want standalone repositories to have SSL support added via # useSSL sslEnabled = False def start(self, resetDir = True): raise NotImplementedError def cl...
Implement a noisy __del__ in BaseServer.
Implement a noisy __del__ in BaseServer. It will complain if the server is still running, and attempt to stop it.
Python
apache-2.0
sassoftware/testutils,sassoftware/testutils,sassoftware/testutils
018583a7b8ce3b74b3942402b37b642d37b54c6d
scripts/prepared_json_to_fasta.py
scripts/prepared_json_to_fasta.py
""" Convert a prepared JSON file from augur into a FASTA file. """ import argparse import Bio import json import logging import sys sys.path.append('..') from base.sequences_process import sequence_set if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("json", help="prepared J...
""" Convert a prepared JSON file from augur into a FASTA file. """ import argparse import Bio import json import logging import sys sys.path.append('..') from base.sequences_process import sequence_set if __name__ == "__main__": parser = argparse.ArgumentParser(description="Convert a prepared JSON file from aug...
Write FASTA output to standard out.
Write FASTA output to standard out.
Python
agpl-3.0
blab/nextstrain-augur,nextstrain/augur,nextstrain/augur,nextstrain/augur
1bacf677311b211ec75780298a4e366c9c65e307
apps/polls/tests.py
apps/polls/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 a...
import datetime from django.utils import timezone from django.test import TestCase from apps.polls.models import Poll class PollMethodTests(TestCase): def test_was_published_recently_with_future_poll(self): """ was_published_recently() should return False for polls whose pub_date is in t...
Create a test to expose the bug
Create a test to expose the bug
Python
bsd-3-clause
cuzen1/teracy-tutorial,cuzen1/teracy-tutorial,cuzen1/teracy-tutorial
9fcf408dad5b97094445677eb42429beaa830c22
apps/homepage/templatetags/homepage_tags.py
apps/homepage/templatetags/homepage_tags.py
from django import template from homepage.models import Tab register = template.Library() @register.tag(name="get_tabs") def get_tabs(parser, token): return GetElementNode() class GetElementNode(template.Node): def __init__(self): pass def render(self, cont...
from django import template from homepage.models import Tab register = template.Library() @register.tag(name="get_tabs") def get_tabs(parser, token): return GetElementNode() class GetElementNode(template.Node): def __init__(self): pass def render(self, cont...
Reduce queries on all pages by using select_related in the get_tabs template tag.
Reduce queries on all pages by using select_related in the get_tabs template tag.
Python
mit
benracine/opencomparison,audreyr/opencomparison,QLGu/djangopackages,cartwheelweb/packaginator,QLGu/djangopackages,miketheman/opencomparison,nanuxbe/djangopackages,QLGu/djangopackages,miketheman/opencomparison,nanuxbe/djangopackages,audreyr/opencomparison,cartwheelweb/packaginator,nanuxbe/djangopackages,cartwheelweb/pac...
53a2d8781e3e5d8e5879d4ef7c62752483323cf9
bfg9000/shell/__init__.py
bfg9000/shell/__init__.py
import os import subprocess from ..platform_name import platform_name if platform_name() == 'windows': from .windows import * else: from .posix import * class shell_list(list): """A special subclass of list used to mark that this command line uses special shell characters.""" pass def execute(...
import os import subprocess from ..platform_name import platform_name if platform_name() == 'windows': from .windows import * else: from .posix import * class shell_list(list): """A special subclass of list used to mark that this command line uses special shell characters.""" pass def execute(...
Fix "quiet" mode for shell.execute()
Fix "quiet" mode for shell.execute()
Python
bsd-3-clause
jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000
7897b985a1ec8fe240c9edead2b53567221cd095
projectkey/k_runner.py
projectkey/k_runner.py
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK import os, imp, inspect from interpreter import cli_interface def k_runner(): """CLI interpreter for the k command.""" # Check every directory from the current all the way to / for a file named key.py checkdirectory = os.getcwd() directories_checked = [] ...
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK import os, imp, inspect, sys from interpreter import cli_interface def k_runner(): """CLI interpreter for the k command.""" # Check every directory from the current all the way to / for a file named key.py checkdirectory = os.getcwd() directories_checked = ...
Convert print statement to sys.stderr.write()
Convert print statement to sys.stderr.write()
Python
mit
crdoconnor/projectkey
85be48f42b03273ea458b7c4db3303ae8b991558
telethon/events/messageedited.py
telethon/events/messageedited.py
from .common import name_inner_event from .newmessage import NewMessage from ..tl import types @name_inner_event class MessageEdited(NewMessage): """ Event fired when a message has been edited. """ @classmethod def build(cls, update): if isinstance(update, (types.UpdateEditMessage, ...
from .common import name_inner_event from .newmessage import NewMessage from ..tl import types @name_inner_event class MessageEdited(NewMessage): """ Event fired when a message has been edited. .. warning:: On channels, `Message.out <telethon.tl.custom.message.Message>` will be ``True`` ...
Document misleading message.out value for events.MessageEdited
Document misleading message.out value for events.MessageEdited
Python
mit
LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,expectocode/Telethon
ad6a0b466c47d945265423c66c71777d61a82de0
utils/http.py
utils/http.py
import httplib2 def url_exists(url): """ Check that a url- when following redirection - exists. This is needed because django's validators rely on python's urllib2 which in verions < 2.6 won't follow redirects. """ h = httplib2.Http() resp, content = h.request(url) h.follow_all_redirec...
import httplib2 def url_exists(url): """ Check that a url- when following redirection - exists. This is needed because django's validators rely on python's urllib2 which in verions < 2.6 won't follow redirects. """ h = httplib2.Http() resp, content = h.request(url, method="HEAD") h.fol...
Make url field check work over head requests
Make url field check work over head requests
Python
agpl-3.0
pculture/unisubs,pculture/unisubs,pculture/unisubs,ReachingOut/unisubs,norayr/unisubs,eloquence/unisubs,norayr/unisubs,ujdhesa/unisubs,norayr/unisubs,ofer43211/unisubs,ujdhesa/unisubs,eloquence/unisubs,ReachingOut/unisubs,pculture/unisubs,wevoice/wesub,ofer43211/unisubs,eloquence/unisubs,wevoice/wesub,ujdhesa/unisubs,w...
c4c2845d2be318a3aaa23e1f279df9b2180add41
test/systems/test_skill_check.py
test/systems/test_skill_check.py
from roglick.engine.ecs import Entity,EntityManager from roglick.components import SkillComponent,SkillSubComponent from roglick.systems import SkillSystem from roglick.engine import event from roglick.events import SkillCheckEvent def test_skill_check(): wins = 0 iters = 1000 em = EntityManager() em...
from roglick.engine.ecs import Entity,EntityManager from roglick.components import SkillComponent,SkillSubComponent from roglick.systems import SkillSystem from roglick.engine import event from roglick.events import SkillCheckEvent def test_skill_check(): wins = 0 iters = 1000 em = EntityManager() em...
Fix tests to use new key structure
Fix tests to use new key structure
Python
mit
Kromey/roglick
096a8972d610379356d668d57d92010707fcf9e1
blockbuster/__init__.py
blockbuster/__init__.py
__author__ = 'matt' from flask import Flask app = Flask(__name__) def startup(): import blockbuster.bb_dbconnector_factory import blockbuster.bb_logging as log import blockbuster.bb_auditlogger as audit try: if blockbuster.bb_dbconnector_factory.DBConnectorInterfaceFactory().create().db_vers...
__author__ = 'matt' __version__ = '1.24.02' target_schema_version = '1.24.00' from flask import Flask app = Flask(__name__) def startup(): import blockbuster.bb_dbconnector_factory import blockbuster.bb_logging as log import blockbuster.bb_auditlogger as audit try: if blockbuster.bb_dbconnec...
Move version numbers back to the package init file
Move version numbers back to the package init file
Python
mit
mattstibbs/blockbuster-server,mattstibbs/blockbuster-server
d4f7178decbb55a9d6f559e7f94ad2cc6d806b18
dashboard/ratings/models.py
dashboard/ratings/models.py
import uuid from django.db import models class Submission(models.Model): uuid = models.UUIDField(default=uuid.uuid4,editable=False) application_date = models.DateTimeField() submission_date = models.DateTimeField() def __str__(self): uid = self.uuid.urn return uid[9:] class Media(mod...
import uuid from django.db import models class Submission(models.Model): uuid = models.UUIDField(default=uuid.uuid4,editable=False) application_date = models.DateTimeField() submission_date = models.DateTimeField() def __str__(self): uid = self.uuid.urn return uid[9:] class Media(mod...
Fix Rating model str method
Fix Rating model str method
Python
mit
daltonamitchell/rating-dashboard,daltonamitchell/rating-dashboard,daltonamitchell/rating-dashboard
e665154e1b522feac8cd46c39ba523bc7197afab
annoying/tests/urls.py
annoying/tests/urls.py
"""URLs for django-annoying's tests""" from __future__ import absolute_import from django.conf.urls import url from . import views urlpatterns = [ url(r'^ajax-request/$', views.ajax_request_view), url(r'^ajax-request-httpresponse/$', views.ajax_request_httpresponse_view), url(r'^render-to-content-type-kwa...
"""URLs for django-annoying's tests""" from __future__ import absolute_import from django.conf.urls import url from . import views import django from distutils.version import StrictVersion django_version = django.get_version() # Use old URL Conf settings for Django <= 1.8. if StrictVersion(django_version) < StrictVe...
Use old URL Conf settings for Django <= 1.8.
Use old URL Conf settings for Django <= 1.8.
Python
bsd-3-clause
kabakchey/django-annoying,skorokithakis/django-annoying,YPCrumble/django-annoying,kabakchey/django-annoying,skorokithakis/django-annoying
bb4a0ca8626f0287a5366e97313018fcc59bcf8f
demo/__init__.py
demo/__init__.py
__project__ = 'TemplateDemo' __version__ = '0.0.0' VERSION = "{0} v{1}".format(__project__, __version__)
from pkg_resources import DistributionNotFound, get_distribution try: __version__ = get_distribution('TemplateDemo').version except DistributionNotFound: __version__ = '(local)'
Deploy Travis CI build 1156 to GitHub
Deploy Travis CI build 1156 to GitHub
Python
mit
jacebrowning/template-python-demo
0baa14975ae1b0729021ecf4d0d88acadb866414
pfamserver/api.py
pfamserver/api.py
from application import app from flask.ext.restful import Api, Resource import os from subprocess import Popen as run, PIPE from distutils.sysconfig import get_python_lib from autoupdate import lib_path, db_path api = Api(app) fetch = '{:s}/hmmer/easel/miniapps/esl-afetch'.format(lib_path) def db(query): cmd = ...
from application import app from flask.ext.restful import Api, Resource import os from subprocess import Popen as run, PIPE from distutils.sysconfig import get_python_lib from autoupdate import lib_path, db_path api = Api(app) fetch = '{:s}/hmmer/easel/miniapps/esl-afetch'.format(lib_path) def db(query): cmd = ...
Improve the query execution order.
Improve the query execution order.
Python
agpl-3.0
ecolell/pfamserver,ecolell/pfamserver,ecolell/pfamserver
92bcca68aad8ba7c8be378ef005c6e94018c2bda
instance/tests/integration/base.py
instance/tests/integration/base.py
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
Make sure integration tests call super.
Make sure integration tests call super.
Python
agpl-3.0
omarkhan/opencraft,omarkhan/opencraft,open-craft/opencraft,omarkhan/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,omarkhan/opencraft,open-craft/opencraft
0a7c6011607bccc61570c8f027c547425e8d53cf
iterm2_tools/tests/test_ipython.py
iterm2_tools/tests/test_ipython.py
from __future__ import print_function, division, absolute_import import subprocess import sys import os def test_IPython(): ipython = os.path.join(sys.prefix, 'bin', 'ipython') if not os.path.exists(ipython): raise Exception("IPython must be installed in %s to run the IPython tests" % os.path.join(sys...
from __future__ import print_function, division, absolute_import import subprocess import sys import os from IPython.testing.tools import get_ipython_cmd def test_IPython(): ipython = get_ipython_cmd() commands = b"""\ 1 raise Exception undefined def f(): pass f() """ p = subprocess.Popen([ipytho...
Use get_ipython_cmd in IPython test
Use get_ipython_cmd in IPython test
Python
mit
asmeurer/iterm2-tools
a61a09a08322c3e74800c0635c4848280ad9341e
src/syntax/infix_coordination.py
src/syntax/infix_coordination.py
__author__ = 's7a' # All imports from nltk.tree import Tree # The infix coordination class class InfixCoordination: # Constructor for the infix coordination def __init__(self): self.has_infix_coordination = False # Break the tree def break_tree(self, tree): self.has_infix_coordinati...
__author__ = 's7a' # All imports from nltk.tree import Tree # The infix coordination class class InfixCoordination: # Constructor for the infix coordination def __init__(self): self.has_infix_coordination = False self.slice_point = -1 self.subtree_list = [] # Break the tree ...
Split the sentence in case of infix coordinatiin
Split the sentence in case of infix coordinatiin
Python
mit
Somsubhra/Simplify,Somsubhra/Simplify,Somsubhra/Simplify
56f7c35722b4d90e04bf2da3d7d72ef0bfd52602
tests/test_decorators.py
tests/test_decorators.py
import pytest from funcy.decorators import * def test_decorator_no_args(): @decorator def inc(call): return call() + 1 @inc def ten(): return 10 assert ten() == 11 def test_decorator_with_args(): @decorator def add(call, n): return call() + n @add(2) de...
import pytest from funcy.decorators import * def test_decorator_no_args(): @decorator def inc(call): return call() + 1 @inc def ten(): return 10 assert ten() == 11 def test_decorator_with_args(): @decorator def add(call, n): return call() + n @add(2) de...
Add a test on failed arg introspection in chained decorators
Add a test on failed arg introspection in chained decorators This is a consequence of not preserving function signature. So this could be fixed by preserving signature or by some workaround.
Python
bsd-3-clause
musicpax/funcy,ma-ric/funcy,Suor/funcy
df8efcc0f86fa9a311ec444da7e6488de2e86d8a
tests/test_repr.py
tests/test_repr.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> import pytest import numpy as np from parameters import T_VALUES, KPT @pytest.mark.parametrize('t', T_VALUES) def test_repr_reload(t, get_model): m1 = get_mode...
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> import pytest import tbmodels # pylint: disable=unused-import import numpy as np from tbmodels._ptools.sparse_matrix import csr # pylint: disable=unused-import fr...
Add back imports to repr test.
Add back imports to repr test.
Python
apache-2.0
Z2PackDev/TBmodels,Z2PackDev/TBmodels
fc123442727ae25f03c5aa8d2fa7bc6fae388ae2
thecure/levels/level1.py
thecure/levels/level1.py
from thecure.levels.base import Level from thecure.sprites import Direction, InfectedHuman class Level1(Level): name = 'level1' start_pos = (900, 6200) def setup(self): boy = InfectedHuman('boy1') self.main_layer.add(boy) boy.move_to(300, 160) boy.set_direction(Direction.D...
from thecure.levels.base import Level from thecure.sprites import Direction, InfectedHuman class Level1(Level): name = 'level1' start_pos = (900, 6200) def setup(self): boy = InfectedHuman('boy1') self.main_layer.add(boy) boy.move_to(1536, 5696) boy.set_direction(Direction...
Move the kids onto the field.
Move the kids onto the field.
Python
mit
chipx86/the-cure
35bbc1d720ba36631fc0a821f7aa953dd8736f2a
laalaa/apps/advisers/middleware.py
laalaa/apps/advisers/middleware.py
from django.http import HttpResponse from django.utils.deprecation import MiddlewareMixin class PingMiddleware(MiddlewareMixin): def process_request(self, request): if request.method == "GET": if request.path == "/ping.json": return self.ping(request) pass def ping...
from django.http import HttpResponse class PingMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): return self.ping(request) or self.get_response(request) def ping(self, request): """ Returns that the server is alive...
Remove use of django.utils.deprecation.MiddlewareMixin for PingMiddleware and upgrade Middleware to latest spec
Remove use of django.utils.deprecation.MiddlewareMixin for PingMiddleware and upgrade Middleware to latest spec
Python
mit
ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api
4c3a21a73dbdf47d5cac04bfda20df7f85596b22
tests/suite/kube_config_utils.py
tests/suite/kube_config_utils.py
"""Describe methods to work with kubeconfig file.""" import pytest import yaml def get_current_context_name(kube_config) -> str: """ Get current-context from kubeconfig. :param kube_config: absolute path to kubeconfig :return: str """ with open(kube_config) as conf: dep = yaml.load(co...
"""Describe methods to work with kubeconfig file.""" import pytest import yaml def get_current_context_name(kube_config) -> str: """ Get current-context from kubeconfig. :param kube_config: absolute path to kubeconfig :return: str """ with open(kube_config) as conf: dep = yaml.load(co...
Fix parsing of the kubeconfig file
Fix parsing of the kubeconfig file
Python
apache-2.0
nginxinc/kubernetes-ingress,nginxinc/kubernetes-ingress,nginxinc/kubernetes-ingress,nginxinc/kubernetes-ingress
4f577eabc45acb6e9a8880d062daa225cc76d64c
logparser/logs/micro/micro.py
logparser/logs/micro/micro.py
# Log Parser for RTI Connext. # # Copyright 2016 Real-Time Innovations, Inc. # # 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 # # ...
# Log Parser for RTI Connext. # # Copyright 2016 Real-Time Innovations, Inc. # # 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 # # ...
Check if module and error code exist
Check if module and error code exist
Python
apache-2.0
rticommunity/rticonnextdds-logparser,rticommunity/rticonnextdds-logparser
f5369b9b0175e221743101abb936b5a2947a3808
polyaxon/libs/paths.py
polyaxon/libs/paths.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import logging import os import shutil logger = logging.getLogger('polyaxon.libs.paths') def delete_path(path): if not os.path.exists(path): return try: shutil.rmtree(path) except OSError: lo...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import logging import os import shutil logger = logging.getLogger('polyaxon.libs.paths') def delete_path(path): if not os.path.exists(path): return try: if os.path.isfile(path): os.remove(pat...
Check if file or dir before deleting
Check if file or dir before deleting
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
9e40fbd1992854db138157d9a7c2fd995722f5ea
massa/__init__.py
massa/__init__.py
# -*- coding: utf-8 -*- from flask import Flask, render_template, g from .container import build from .web import bp as web from .api import bp as api def create_app(config=None): app = Flask('massa') app.config.from_object(config or 'massa.config.Production') sl = build(app.config) app.register_bl...
# -*- coding: utf-8 -*- from flask import Flask, render_template, g from .container import build from .web import bp as web from .api import bp as api def create_app(config=None): app = Flask('massa') app.config.from_object(config or 'massa.config.Production') app.config.from_envvar('MASSA_CONFIG', silen...
Add the ability to specify an alternative configuration object.
Add the ability to specify an alternative configuration object.
Python
mit
jaapverloop/massa
bb48c975cfb4f43b8ffc5c7edfd42a8253fa7d66
skan/test/test_pipe.py
skan/test/test_pipe.py
import os import pytest import tempfile import pandas from skan import pipe @pytest.fixture def image_filename(): rundir = os.path.abspath(os.path.dirname(__file__)) datadir = os.path.join(rundir, 'data') return os.path.join(datadir, 'retic.tif') def test_pipe(image_filename): data = pipe.process_im...
import os import pytest import tempfile import pandas from skan import pipe @pytest.fixture def image_filename(): rundir = os.path.abspath(os.path.dirname(__file__)) datadir = os.path.join(rundir, 'data') return os.path.join(datadir, 'retic.tif') def test_pipe(image_filename): data = pipe.process_im...
Fix test for output skeleton plot
Fix test for output skeleton plot
Python
bsd-3-clause
jni/skan
157d5c2f680134fa5b9f4f69320259416c46f44b
tp/netlib/objects/Order_Probe.py
tp/netlib/objects/Order_Probe.py
import copy from Order import Order class Order_Probe(Order): no = 34 def __init__(self, sequence, \ id, slot, type, \ *args, **kw): self.no = 34 apply(Order.__init__, (self, sequence, id, slot, type, -1, [])+args, kw)
import copy from Order import Order class Order_Probe(Order): no = 34 def __init__(self, *args, **kw): self.no = 34 Order.__init__(self, *args, **kw)
Fix the Order Probe message for the new order stuff.
Fix the Order Probe message for the new order stuff.
Python
lgpl-2.1
thousandparsec/libtpproto-py,thousandparsec/libtpproto-py
5619b04f55418c943e7a7af606b5247ce4441160
examples/IPLoM_example.py
examples/IPLoM_example.py
# for local run, before pygraphc packaging import sys sys.path.insert(0, '../pygraphc/misc') from IPLoM import * sys.path.insert(0, '../pygraphc/clustering') from ClusterUtility import * from ClusterEvaluation import * # set path ip_address = '161.166.232.17' standard_path = '/home/hudan/Git/labeled-authlog/dataset/' ...
# for local run, before pygraphc packaging import sys sys.path.insert(0, '../pygraphc/misc') from IPLoM import * sys.path.insert(0, '../pygraphc/evaluation') from ExternalEvaluation import * # set path ip_address = '161.166.232.17' standard_path = '/home/hudan/Git/labeled-authlog/dataset/' + ip_address standard_file =...
Change module path for cluster evaluation
Change module path for cluster evaluation
Python
mit
studiawan/pygraphc
6fc9032bc372aad7b9c1217b44ff081ac9108af2
manoseimas/common/tests/utils/test_words.py
manoseimas/common/tests/utils/test_words.py
# coding: utf-8 from __future__ import unicode_literals import unittest from manoseimas.scrapy import textutils class WordCountTest(unittest.TestCase): def test_get_word_count(self): word_count = textutils.get_word_count('Žodžiai, lietuviškai.') self.assertEqual(word_count, 2) def test_get...
# coding: utf-8 from __future__ import unicode_literals import unittest from manoseimas.common.utils import words class WordCountTest(unittest.TestCase): def test_get_word_count(self): word_count = words.get_word_count('Žodžiai, lietuviškai.') self.assertEqual(word_count, 2) def test_get_w...
Fix word_count test import paths.
Fix word_count test import paths.
Python
agpl-3.0
ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt
2e0c4940b208d0b029e7b43f8c3595fa3b6d2f18
examples/list-pods-watch.py
examples/list-pods-watch.py
import asyncio import powershift.endpoints as endpoints import powershift.resources as resources client = endpoints.AsyncClient() async def run_query(): projects = await client.oapi.v1.projects.get() #print(projects) #print(resources.dumps(projects, indent=4, sort_keys=True)) #print() project =...
import sys import asyncio import powershift.endpoints as endpoints async def run_query(): namespace = sys.argv[1] print('namespace=%r' % namespace) client = endpoints.AsyncClient() pods = await client.api.v1.namespaces(namespace=namespace).pods.get() for pod in pods.items: print(' O...
Make watch example for pods more durable.
Make watch example for pods more durable.
Python
bsd-2-clause
getwarped/powershift
7a81312d1e7b4b0de0343a907e91dd120625f807
lily/users/authentication/social_auth/providers/google.py
lily/users/authentication/social_auth/providers/google.py
from django.conf import settings from ..exceptions import InvalidProfileError from .base import BaseAuthProvider class GoogleAuthProvider(BaseAuthProvider): client_id = settings.SOCIAL_AUTH_GOOGLE_CLIENT_ID client_secret = settings.SOCIAL_AUTH_GOOGLE_SECRET scope = ['openid', 'email', 'profile'] auth...
from django.conf import settings from ..exceptions import InvalidProfileError from .base import BaseAuthProvider class GoogleAuthProvider(BaseAuthProvider): client_id = settings.SOCIAL_AUTH_GOOGLE_CLIENT_ID client_secret = settings.SOCIAL_AUTH_GOOGLE_SECRET scope = [ 'https://www.googleapis.com/a...
Update scopes for Google Auth2
Update scopes for Google Auth2
Python
agpl-3.0
HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily
2ef20e1658eaf5631395940bbb8583be628e6483
utils/package_version.py
utils/package_version.py
#!/usr/bin/env python import sys import subprocess mep_version = "MEP_VERSION" os_family = "OS_FAMILY" output = subprocess.check_output( [ "curl", "-s", "http://package.mapr.com/releases/MEP/MEP-%s/%s/" % (mep_version, os_family) ] ) for line in output.splitlines(): index1 = line.find('"ma...
#!/usr/bin/env python import sys import subprocess mep_version = "MEP_VERSION" os_family = "OS_FAMILY" output = subprocess.check_output( [ "curl", "-s", "http://package.mapr.com/releases/MEP/MEP-%s/%s/" % (mep_version, os_family) ] ) for line in output.splitlines(): index1 = line.find('"ma...
Support MEP-6.1.0 which has version containing 4 numbers like mapr-spark-2.3.2.0 while the version directory contains still 3 numbers
Support MEP-6.1.0 which has version containing 4 numbers like mapr-spark-2.3.2.0 while the version directory contains still 3 numbers
Python
apache-2.0
qinjunjerry/MapRSetup,qinjunjerry/MapRSetup,qinjunjerry/MapRSetup
1303890759afb3ae0466066dcdc9309b50dd73ef
CodeFights/weakNumbers.py
CodeFights/weakNumbers.py
#!/usr/local/bin/python # Code Fights Weak Numbers Problem def weakNumbers(n): def get_divisors(n): divs = [] for i in range(1, n + 1): count = 0 for d in range(1, i + 1): if i % d == 0: count += 1 divs.append(count) r...
#!/usr/local/bin/python # Code Fights Weak Numbers Problem def weakNumbers(n): def get_divisors(n): divs = [] for i in range(1, n + 1): count = 0 for d in range(1, i + 1): if i % d == 0: count += 1 divs.append(count) r...
Solve Code Fights weak numbers problem
Solve Code Fights weak numbers problem
Python
mit
HKuz/Test_Code
818a1b6537c6daedaa4f8320aeb8ff4b25f365d9
inboxen/tests/settings.py
inboxen/tests/settings.py
from __future__ import absolute_import import os os.environ['INBOX_TESTING'] = '1' os.environ["INBOXEN_ADMIN_ACCESS"] = '1' from inboxen.settings import * CACHES = { "default": { "BACKEND": "django.core.cache.backends.locmem.LocMemCache" } } db = os.environ.get('DB') postgres_user = os.environ.get('P...
from __future__ import absolute_import import os os.environ['INBOX_TESTING'] = '1' os.environ["INBOXEN_ADMIN_ACCESS"] = '1' from inboxen.settings import * CACHES = { "default": { "BACKEND": "django.core.cache.backends.locmem.LocMemCache" } } db = os.environ.get('DB', "sqlite") postgres_user = os.envi...
Make tests run with sqlite by default
Make tests run with sqlite by default
Python
agpl-3.0
Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen
c045dc59bc313055eb74513e2961ce2cbae87450
corehq/apps/api/util.py
corehq/apps/api/util.py
from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext as _ from couchdbkit.exceptions import ResourceNotFound def get_object_or_not_exist(cls, doc_id, domain, additional_doc_types=None): """ Given a Document class, id, and domain, get that object or raise an Ob...
from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext as _ from couchdbkit.exceptions import ResourceNotFound def get_object_or_not_exist(cls, doc_id, domain, additional_doc_types=None): """ Given a Document class, id, and domain, get that object or raise an Ob...
Check doc type before wrapping
Check doc type before wrapping
Python
bsd-3-clause
dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq
da65e041a7d05eee1cdda7c6f5a23ae2fea70103
rules/arm-toolchain.py
rules/arm-toolchain.py
import xyz class ArmToolchain(xyz.BuildProtocol): group_only = True pkg_name = 'arm-toolchain' deps = [('gcc', {'target': 'arm-none-eabi'}), ('binutils', {'target': 'arm-none-eabi'}), ('gdb', {'target': 'arm-none-eabi'}) ] rules = ArmToolchain
import xyz class ArmToolchain(xyz.BuildProtocol): group_only = True pkg_name = 'arm-toolchain' deps = [('gcc', {'target': 'arm-none-eabi'}), ('binutils', {'target': 'arm-none-eabi'}), ('gdb', {'target': 'arm-none-eabi'}), ('stlink', {}) ] rules = ArmToolchai...
Add stlink package to arm toolchain
Add stlink package to arm toolchain
Python
mit
BreakawayConsulting/xyz
bb1ab6d72850fdb9ecc9119afa53045a3564a7e2
test/unit/test_flask_multi_redis.py
test/unit/test_flask_multi_redis.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys sys.modules['redis'] = None def test_redis_import_error(): """Test that we can load FlaskMultiRedis even if redis module is not available.""" from flask_multi_redis import FlaskMultiRedis f = FlaskMultiRedis() assert f.provider_class is ...
#! /usr/bin/env python # -*- coding: utf-8 -*- from sys import modules, version_info if version_info >= (3,): from imp import reload def test_redis_import_error(): """Test that we can load FlaskMultiRedis even if redis module is not available.""" import flask_multi_redis modules['redis'] = None...
Update unit tests to improve redis_import_error
Update unit tests to improve redis_import_error
Python
agpl-3.0
max-k/flask-multi-redis
804696126480f36fddd74a8a0d24b0c4274f0f54
ants/utils/convert_nibabel.py
ants/utils/convert_nibabel.py
__all__ = ["to_nibabel", "from_nibabel"] import os from tempfile import mktemp import numpy as np from ..core import ants_image_io as iio2 def to_nibabel(image): """ Convert an ANTsImage to a Nibabel image """ import nibabel as nib tmpfile = mktemp(suffix=".nii.gz") image.to_filename(tmpfile)...
__all__ = ["to_nibabel", "from_nibabel"] import os from tempfile import mkstemp import numpy as np from ..core import ants_image_io as iio2 def to_nibabel(image): """ Convert an ANTsImage to a Nibabel image """ import nibabel as nib fd, tmpfile = mkstemp(suffix=".nii.gz") image.to_filename(tm...
Use safe mkstemp instead of unsafe mktemp in format conversion
Use safe mkstemp instead of unsafe mktemp in format conversion
Python
apache-2.0
ANTsX/ANTsPy,ANTsX/ANTsPy,ANTsX/ANTsPy,ANTsX/ANTsPy
c25d55643953d5bce511b1d3d32e6fce162b4ccd
hoptoad/tests.py
hoptoad/tests.py
from django.test import TestCase from django.conf import settings class BasicTests(TestCase): """Basic tests like setup and connectivity.""" def test_api_key_present(self): self.assertTrue('HOPTOAD_API_KEY' in settings.get_all_members(), msg='The HOPTOAD_API_KEY setting is not present....
import urllib2 from django.test import TestCase from django.conf import settings class BasicTests(TestCase): """Basic tests like setup and connectivity.""" def test_api_key_present(self): self.assertTrue('HOPTOAD_API_KEY' in settings.get_all_members(), msg='The HOPTOAD_API_KEY setting ...
Add a unit test for hoptoadapp.com connectivity.
Add a unit test for hoptoadapp.com connectivity.
Python
mit
sjl/django-hoptoad,sjl/django-hoptoad
0f5aeeedd580cce2970127d4b7e69c4a6427d343
wsme/tests/test_spore.py
wsme/tests/test_spore.py
import unittest try: import simplejson as json except ImportError: import json from wsme.tests.protocol import WSTestRoot import wsme.spore class TestSpore(unittest.TestCase): def test_spore(self): spore = wsme.spore.getdesc(WSTestRoot()) print spore spore = json.loads(spore) ...
import unittest try: import simplejson as json except ImportError: import json from wsme.tests.protocol import WSTestRoot import wsme.tests.test_restjson import wsme.spore class TestSpore(unittest.TestCase): def test_spore(self): spore = wsme.spore.getdesc(WSTestRoot()) print spore ...
Fix the spore test, as some functions were added by restjson
Fix the spore test, as some functions were added by restjson
Python
mit
stackforge/wsme
25cf03a2ecfb80e0866680a7781adfe11c54ebe9
ircstat/plugins/totals.py
ircstat/plugins/totals.py
# Copyright 2013 John Reese # Licensed under the MIT license from ..lib import is_bot from ..ent import Message from ..graphs import NetworkKeyComparison, NetworkUserComparison from .base import Plugin class Totals(Plugin): """Gathers total message type statistics, broken down by channel, day and user.""" ...
# Copyright 2013 John Reese # Licensed under the MIT license from ..lib import is_bot from ..ent import Message from ..graphs import NetworkKeyComparison, NetworkUserComparison from .base import Plugin class Totals(Plugin): """Gathers total message type statistics, broken down by channel, day and user.""" ...
Add third graph for Totals plugin
Add third graph for Totals plugin
Python
mit
jreese/ircstat,jreese/ircstat
3dbdc8581bcb366e5b6749d523f25589d3ede9ed
test/test_cart.py
test/test_cart.py
import cart def test_valid_cart_from_csv(): _cart = cart.cart_from_csv('test/cart_files/default_cart.csv') assert _cart._product_prices == {'apple': 0.15, 'ice cream': 3.49, 'strawberries': 2.00, 'sni...
# -*- coding: utf-8 -*- import cart from cart._compatibility import utf8 def test_valid_cart_from_csv(): _cart = cart.cart_from_csv('test/cart_files/default_cart.csv') assert _cart._product_prices == {'apple': 0.15, 'ice cream': 3.49, ...
Add tests for unicode csv files.
Add tests for unicode csv files.
Python
mit
davidhalter-archive/shopping_cart_example
423c29e859440b4a774a924badb7da4417dbd5c6
tests/test_provider_lawrenceks.py
tests/test_provider_lawrenceks.py
import busbus from busbus.provider.lawrenceks import LawrenceTransitProvider import arrow import pytest @pytest.fixture(scope='module') def lawrenceks_provider(engine): return LawrenceTransitProvider(engine) def test_agency_phone_e164(lawrenceks_provider): agency = next(lawrenceks_provider.agencies) as...
import busbus from busbus.provider.lawrenceks import LawrenceTransitProvider import arrow import pytest @pytest.fixture(scope='module') def lawrenceks_provider(engine): return LawrenceTransitProvider(engine) def test_agency_phone_e164(lawrenceks_provider): agency = next(lawrenceks_provider.agencies) as...
Add another stop to test_43_to_eaton_hall
Add another stop to test_43_to_eaton_hall
Python
mit
spaceboats/busbus
abb61ff0b73eb06b65223e30fcff643df4114c53
tools/geometry/icqCompositeShape.py
tools/geometry/icqCompositeShape.py
#!/usr/bin/env python import re from icqShape import Shape class CompositeShapeBuilder( Shape ): def __init__( self, shape_tuples=None ): """ Constructor @param shape_tuples list of tuples (expr_var, shape) """ self.shape_tuples = shape_tuples def compose( self, expr...
#!/usr/bin/env python import re from icqShape import Shape class ShapeComposer( Shape ): def __init__( self, shape_tuples=None ): self.shape_tuples = shape_tuples self.csg = None def __add__( self, other ): """ Union @param other Shape instance @return Compos...
Enhance the ShapeComposer - still not working.
Enhance the ShapeComposer - still not working.
Python
unknown
gregvonkuster/icqsol,pletzer/icqsol,pletzer/icqsol,gregvonkuster/icqsol,gregvonkuster/icqsol,pletzer/icqsol,pletzer/icqsol,gregvonkuster/icqsol
df43b7fc089abb2fff87841173c28b3f5849a3b1
profile_xf11id/startup/50-scans.py
profile_xf11id/startup/50-scans.py
from ophyd.userapi.scan_api import Scan, AScan, DScan, Count, estimate scan = Scan() ascan = AScan() ascan.default_triggers = [bpm_cam_acq] ascan.default_detectors = [bpm_tot5] dscan = DScan() # Use ct as a count which is a single scan. ct = Count()
from ophyd.userapi.scan_api import Scan, AScan, DScan, Count, estimate scan = Scan() ascan = AScan() ascan.default_triggers = [bpm_cam_acq] ascan.default_detectors = [bpm_tot5] dscan = DScan() # Use ct as a count which is a single scan. ct = Count() class CHXAScan(AScan): def __call__(self, *args, **kwargs): ...
Define a CHX Ascan class.
ENH: Define a CHX Ascan class.
Python
bsd-2-clause
NSLS-II-CHX/ipython_ophyd,NSLS-II-CHX/ipython_ophyd
d8d01d89710cd1d752809b8cd91d934092e99adf
pythonforandroid/recipes/ruamel.yaml/__init__.py
pythonforandroid/recipes/ruamel.yaml/__init__.py
from pythonforandroid.toolchain import PythonRecipe class RuamelYamlRecipe(PythonRecipe): version = '0.14.5' url = 'https://pypi.python.org/packages/5c/13/c120a06b3add0f9763ca9190e5f6edb9faf9d34b158dd3cff7cc9097be03/ruamel.yaml-{version}.tar.gz' depends = [ ('python2', 'python3crystax') ] site_packag...
from pythonforandroid.recipe import PythonRecipe class RuamelYamlRecipe(PythonRecipe): version = '0.15.77' url = 'https://pypi.python.org/packages/source/r/ruamel.yaml/ruamel.yaml-{version}.tar.gz' depends = [('python2', 'python3crystax'), 'setuptools'] site_packages_name = 'ruamel' call_hostpytho...
Update to last version, fixes import and deps
Update to last version, fixes import and deps
Python
mit
kronenpj/python-for-android,kronenpj/python-for-android,germn/python-for-android,kivy/python-for-android,kronenpj/python-for-android,kivy/python-for-android,rnixx/python-for-android,rnixx/python-for-android,germn/python-for-android,kivy/python-for-android,PKRoma/python-for-android,germn/python-for-android,germn/python-...
c3d40abf3b7c201836bf674da05423d86c345498
ckanext/romania_theme/plugin.py
ckanext/romania_theme/plugin.py
import ckan.model as model import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit import os def get_number_of_files(): return model.Session.execute("select count(*) from resource where state = 'active'").first()[0] def get_number_of_external_links(): return model.Session.execute("select count...
import ckan.model as model import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit import os def get_number_of_files(): return model.Session.execute("select count(*) from resource where state = 'active'").first()[0] def get_number_of_external_links(): return model.Session.execute("select count...
Add all type of unwanted files
Add all type of unwanted files
Python
agpl-3.0
govro/ckanext-romania_theme,govro/ckanext-romania_theme,govro/ckanext-romania_theme,govro/ckanext-romania_theme
88fbd428ceb79d6e176ff235256c8e5951815085
inspector/inspector/urls.py
inspector/inspector/urls.py
from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic import TemplateView # Uncomment the next two lines to enable the admin: from django.contrib impor...
from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic import TemplateView # Uncomment the next two lines to enable the admin: from django.contrib impor...
Make the url structure a bit more sensible.
Make the url structure a bit more sensible.
Python
bsd-2-clause
refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,abhijo89/django-cbv-inspector
85d4496a5ce7cb801c09bacbc0dd4a67c084c504
main.py
main.py
__author__ = 'tri' from controller.event_controller import EventController from controller.env_controller import EnvController from controller.main_controller import MainController import pygame env_controller = EnvController() event_controller = EventController() main_controller = MainController(event_controller, en...
__author__ = 'tri' from controller.event_controller import EventController from controller.env_controller import EnvController from controller.main_controller import MainController import pygame env_controller = EnvController() event_controller = EventController() main_controller = MainController(event_controller, en...
Resolve issuse about cpu, it depends on fps
Resolve issuse about cpu, it depends on fps
Python
apache-2.0
ductri/game_programming-ass1
b6a039369bc18456667c82b8e57f8b8621aed6d1
deprecated/__init__.py
deprecated/__init__.py
# -*- coding: utf-8 -*- """ Deprecated Library ================== Python ``@deprecated`` decorator to deprecate old python classes, functions or methods. """ #: Module Version Number, see `PEP 396 <https://www.python.org/dev/peps/pep-0396/>`_. __version__ = "1.2.11" from deprecated.classic import deprecated
# -*- coding: utf-8 -*- """ Deprecated Library ================== Python ``@deprecated`` decorator to deprecate old python classes, functions or methods. """ __version__ = "1.2.11" __author__ = u"Laurent LAPORTE <tantale.solutions@gmail.com>" __date__ = "unreleased" __credits__ = "(c) Laurent LAPORTE" from deprecat...
Update :mod:`deprecated` metadata: add ``__author__``, ``__date__`` and ``__credits__``.
Update :mod:`deprecated` metadata: add ``__author__``, ``__date__`` and ``__credits__``.
Python
mit
tantale/deprecated
9307908f5a5816c709faf034958a8d737dc21078
tests/test_api.py
tests/test_api.py
import os import sys import json import responses import unittest CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Allow import of api.py if os.path.join(MS_WD, 'utils') not in sys.path: sys.path.insert(0, os.path.join(MS_WD, 'utils')) # Use mu...
import os import sys import json import responses import unittest CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Allow import of api.py if os.path.join(MS_WD, 'utils') not in sys.path: sys.path.insert(0, os.path.join(MS_WD, 'utils')) if os.pa...
Add unit test for newly initialized db
Add unit test for newly initialized db
Python
mpl-2.0
mitre/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,awest1339/multiscanner
599b0524d4228b41990c0b4e00106660589160c2
processrunner/runcommand.py
processrunner/runcommand.py
# -*- coding: utf-8 -*- import sys from .processrunner import ProcessRunner from .writeout import writeOut def runCommand(command, outputPrefix="ProcessRunner> "): """Easy invocation of a command with default IO streams Args: command (list): List of strings to pass to subprocess.Popen Kwargs: ...
# -*- coding: utf-8 -*- import sys from .processrunner import ProcessRunner from .writeout import writeOut def runCommand(command, outputPrefix="ProcessRunner> ", returnAllContent=False): """Easy invocation of a command with default IO streams returnAllContent as False (default): Args: command ...
Expand use for returning both exit code + content
runCommand: Expand use for returning both exit code + content
Python
mit
arobb/python-processrunner,arobb/python-processrunner
10f931ab6831f9fb403912a0d0d357d35561d099
subliminal/__init__.py
subliminal/__init__.py
# -*- coding: utf-8 -*- # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # # This file is part of subliminal. # # subliminal is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 3 of...
# -*- coding: utf-8 -*- # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # # This file is part of subliminal. # # subliminal is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 3 of...
Add some core components to subliminal
Add some core components to subliminal
Python
mit
ofir123/subliminal,fernandog/subliminal,neo1691/subliminal,nvbn/subliminal,bogdal/subliminal,ravselj/subliminal,SickRage/subliminal,oxan/subliminal,t4lwh/subliminal,Elettronik/subliminal,kbkailashbagaria/subliminal,juanmhidalgo/subliminal,hpsbranco/subliminal,h3llrais3r/subliminal,ratoaq2/subliminal,getzze/subliminal,D...
801c370ce88b3b2689da5890ebf09bae533089f4
tob-api/tob_api/hyperledger_indy.py
tob-api/tob_api/hyperledger_indy.py
import os import platform def config(): genesis_txn_path = "/opt/app-root/genesis" platform_name = platform.system() if platform_name == "Windows": genesis_txn_path = os.path.realpath("./app-root/genesis") return { "genesis_txn_path": genesis_txn_path, }
import os import platform import requests from pathlib import Path def getGenesisData(): """ Get a copy of the genesis transaction file from the web. """ genesisUrl = os.getenv('GENESIS_URL', 'http://138.197.170.136/genesis').lower() response = requests.get(genesisUrl) return response.text def...
Add support for downloading the genesis transaction file.
Add support for downloading the genesis transaction file.
Python
apache-2.0
swcurran/TheOrgBook,WadeBarnes/TheOrgBook,swcurran/TheOrgBook,WadeBarnes/TheOrgBook,swcurran/TheOrgBook,swcurran/TheOrgBook,WadeBarnes/TheOrgBook,swcurran/TheOrgBook,WadeBarnes/TheOrgBook,WadeBarnes/TheOrgBook
d4a1a75407610caaad769c26131f7d34ef977a70
flocker/ca/test/test_validation.py
flocker/ca/test/test_validation.py
# Copyright ClusterHQ Inc. See LICENSE file for details. """ Test validation of keys generated by flocker-ca. """ from twisted.trial.unittest import SynchronousTestCase from .. import amp_server_context_factory, rest_api_context_factory from ..testtools import get_credential_sets class ClientValidationContextFact...
# Copyright ClusterHQ Inc. See LICENSE file for details. """ Test validation of keys generated by flocker-ca. """ from twisted.trial.unittest import SynchronousTestCase from .. import amp_server_context_factory, rest_api_context_factory from ..testtools import get_credential_sets class ClientValidationContextFact...
Address review comment: More standard assertions.
Address review comment: More standard assertions.
Python
apache-2.0
hackday-profilers/flocker,achanda/flocker,mbrukman/flocker,LaynePeng/flocker,achanda/flocker,1d4Nf6/flocker,hackday-profilers/flocker,wallnerryan/flocker-profiles,LaynePeng/flocker,hackday-profilers/flocker,mbrukman/flocker,moypray/flocker,moypray/flocker,mbrukman/flocker,agonzalezro/flocker,Azulinho/flocker,wallnerrya...
2fead2caae3ff0e021ebfd9f14a04c8ca142c86f
blimp/users/authentication.py
blimp/users/authentication.py
from rest_framework import exceptions from rest_framework_jwt.settings import api_settings from rest_framework_jwt.authentication import JSONWebTokenAuthentication try: from django.contrib.auth import get_user_model except ImportError: # Django < 1.5 from django.contrib.auth.models import User else: User ...
from rest_framework import exceptions from rest_framework_jwt.settings import api_settings from rest_framework_jwt.authentication import JSONWebTokenAuthentication from .models import User jwt_decode_handler = api_settings.JWT_DECODE_HANDLER class JWTAuthentication(JSONWebTokenAuthentication): def authenticate...
Remove unused user model import handling
Remove unused user model import handling
Python
agpl-3.0
jessamynsmith/boards-backend,GetBlimp/boards-backend,jessamynsmith/boards-backend
8a5d52d388183000af4472afa47db1ddcec96331
byceps/application_factory.py
byceps/application_factory.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ application factory ~~~~~~~~~~~~~~~~~~~ Create and initialize the application using a configuration specified by an environment variable. :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from .application import create_...
# -*- coding: utf-8 -*- """ application factory ~~~~~~~~~~~~~~~~~~~ Create and initialize the application using a configuration specified by an environment variable. :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from .application import create_app, init_app from .ut...
Remove unnecessary shebang line from module
Remove unnecessary shebang line from module
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps
4e28e43fea2eaa08006eeb4d70159c8ebd3c83b4
flask_uploads/__init__.py
flask_uploads/__init__.py
import loaders loader = loaders.Lazy( '%s.models' % __name__, ('Upload',) ) import extensions from .functions import ( delete, save, save_file, save_images, ) from .models import Upload def init(db, Storage, resizer=None): extensions.db = db extensions.resizer = resizer extensions...
import loaders loader = loaders.Lazy( '%s.models' % __name__, ('Upload',) ) import extensions from .functions import ( delete, save, save_file, save_images, ) from .models import Upload def init(db, Storage, resizer=None): if 'upload' in db.metadata.tables: return # Already regis...
Make sure model isn't added several times.
Make sure model isn't added several times.
Python
mit
FelixLoether/flask-uploads,FelixLoether/flask-image-upload-thing
f25f08625d369d7737516971256140af26015235
astropy/timeseries/io/__init__.py
astropy/timeseries/io/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from . import kepler
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .kepler import *
Make sure I/O functions appear in API docs
Make sure I/O functions appear in API docs
Python
bsd-3-clause
bsipocz/astropy,dhomeier/astropy,StuartLittlefair/astropy,MSeifert04/astropy,bsipocz/astropy,mhvk/astropy,dhomeier/astropy,stargaser/astropy,lpsinger/astropy,pllim/astropy,lpsinger/astropy,StuartLittlefair/astropy,mhvk/astropy,stargaser/astropy,MSeifert04/astropy,MSeifert04/astropy,larrybradley/astropy,dhomeier/astropy...
8e8a4360124a033ad3c5bd26bfe2b3896155f25a
tests/TestDBControl.py
tests/TestDBControl.py
import unittest from blo.DBControl import DBControl class TestDBControl(unittest.TestCase): pass
import unittest from pathlib import Path from blo.DBControl import DBControl class TestDBControlOnMemory(unittest.TestCase): def setUp(self): self.db_control = DBControl() def test_initializer_for_file(self): file_path = "./test.sqlite" self.db_control.close_connect() self.db_...
Add test pattern of initializer for file.
Add test pattern of initializer for file.
Python
mit
10nin/blo,10nin/blo
d17b3f2da3daaea5b0a0468d231fa72ce043a6cc
game/itemsets/__init__.py
game/itemsets/__init__.py
# -*- coding: utf-8 -*- """ Item Sets - ItemSet.dbc """ from .. import * from ..globalstrings import * class ItemSet(Model): pass class ItemSetTooltip(Tooltip): def tooltip(self): items = self.obj.getItems() maxItems = len(items) self.append("name", ITEM_SET_NAME % (self.obj.getName(), 0, maxItems), ...
# -*- coding: utf-8 -*- """ Item Sets - ItemSet.dbc """ from .. import * from ..globalstrings import * class ItemSet(Model): pass class ItemSetTooltip(Tooltip): def tooltip(self): items = self.obj.getItems() maxItems = len(items) self.append("name", ITEM_SET_NAME % (self.obj.getName(), 0, maxItems), ...
Use spaces before the item name string in itemsets
Use spaces before the item name string in itemsets
Python
cc0-1.0
jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow
9cc09cc388d4bb9d503375083501ce566b57b65f
backend/io/connectors/Tellstick.py
backend/io/connectors/Tellstick.py
import os import socket import tftpy import time from RAXA.settings import PROJECT_ROOT from backend.io.connector import Connector class Tellstick(Connector): TYPE = 'Tellstick' def is_usable(self): return self.connector.version.startswith('RAXA') def update(self): s = socket.socket(sock...
import os import socket import time from RAXA.settings import PROJECT_ROOT from backend.io.connector import Connector class Tellstick(Connector): TYPE = 'Tellstick' def is_usable(self): return self.connector.version.startswith('RAXA') def update(self): s = socket.socket(socket.AF_INET, s...
Fix unused import which could creates crashes
Fix unused import which could creates crashes
Python
agpl-3.0
Pajn/RAXA-Django,Pajn/RAXA-Django
bf006aa3dc8ee331eccb4abd8244a134949c8cc0
bawebauth/apps/bawebauth/fields.py
bawebauth/apps/bawebauth/fields.py
# -*- coding: utf-8 -*- from django.db import models class PositiveBigIntegerField(models.PositiveIntegerField): """Represents MySQL's unsigned BIGINT data type (works with MySQL only!)""" empty_strings_allowed = False def get_internal_type(self): return "PositiveBigIntegerField" def db_type(...
# -*- coding: utf-8 -*- from django.db import models class PositiveBigIntegerField(models.PositiveIntegerField): """Represents MySQL's unsigned BIGINT data type (works with MySQL only!)""" empty_strings_allowed = False def db_type(self, connection): if connection.settings_dict['ENGINE'] == 'django...
Fix tests by removing obsolete internal field type declaration
Fix tests by removing obsolete internal field type declaration
Python
mit
mback2k/django-bawebauth,mback2k/django-bawebauth,mback2k/django-bawebauth,mback2k/django-bawebauth
f82fe96cf520ec2f635f34f911bc8d4ccd78d776
mfnd/todotask.py
mfnd/todotask.py
#!/usr/bin/env python3 """ Module for tasks in the to-do list """ class TodoTask: """ Represents a task in the to-do list """ def __init__(self, description): """ Initialize a to-do list task item """ self.description = description self.completionStatus = 0 ...
#!/usr/bin/env python3 """ Module for tasks in the to-do list """ class TodoTask: """ Represents a task in the to-do list """ def __init__(self, description): """ Initialize a to-do list task item """ self.description = description self.completionStatus = 0 ...
Implement str method for TodoTask class
feature: Implement str method for TodoTask class
Python
mit
mes32/mfnd
688292246b9db3eb0aa5be752612ae2df2fcff67
tools/tests/factory_configuration/factory_configuration_test.py
tools/tests/factory_configuration/factory_configuration_test.py
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that the configuration for each BuildFactory matches its expectation. """ import os import sys sys.path.append('master') sys.path.append(...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that the configuration for each BuildFactory matches its expectation. """ import os import sys buildbot_path = os.path.join(os.path.abspa...
Update factory configuration test to work independently of working directory
Update factory configuration test to work independently of working directory (SkipBuildbotRuns) R=rmistry@google.com Review URL: https://codereview.chromium.org/15317003 git-svn-id: 32fc27f4dcfb6c0385cd9719852b95fe6680452d@9186 2bbb7eff-a529-9590-31e7-b0007b416f81
Python
bsd-3-clause
Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Ti...
fc3f2e2f9fdf8a19756bbf8b5bd1442b71ac3a87
scrapi/settings/__init__.py
scrapi/settings/__init__.py
import logging from raven import Client from fluent import sender from raven.contrib.celery import register_signal from scrapi.settings.defaults import * from scrapi.settings.local import * logging.basicConfig(level=logging.INFO) logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING...
import logging from raven import Client from fluent import sender from raven.contrib.celery import register_signal from scrapi.settings.defaults import * from scrapi.settings.local import * logging.basicConfig(level=logging.INFO) logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING...
Add new place to look for celery tasks
Add new place to look for celery tasks
Python
apache-2.0
CenterForOpenScience/scrapi,erinspace/scrapi,felliott/scrapi,mehanig/scrapi,fabianvf/scrapi,mehanig/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,alexgarciac/scrapi,fabianvf/scrapi,ostwald/scrapi,icereval/scrapi
96eca23792541979e73ccb247368394cd28e9530
Code/Native/update_module_builder.py
Code/Native/update_module_builder.py
""" This script downloads and updates the module builder. """ # Dont checkout all files IGNORE_FILES = [ "__init__.py", ".gitignore", "LICENSE", "README.md", "config.ini", "Source/config_module.cpp", "Source/config_module.h", "Source/ExampleClass.cpp", "Source/ExampleClass.h", ...
""" This script downloads and updates the module builder. """ # Dont checkout all files IGNORE_FILES = [ "__init__.py", ".gitignore", "LICENSE", "README.md", "config.ini", "Source/config_module.cpp", "Source/config_module.h", "Source/ExampleClass.cpp", "Source/ExampleClass.h", ...
Fix missing __init__ in native directory
Fix missing __init__ in native directory
Python
mit
croxis/SpaceDrive,croxis/SpaceDrive,croxis/SpaceDrive
e977331dff6fc4f03eef42be504ec3d747e3f9ad
sana_builder/webapp/models.py
sana_builder/webapp/models.py
from django.db import models # Create your models here.
from django.db import models from django.contrib.auth.models import User class Procedure(models.Model): title = models.CharField(max_length=50) author = models.CharField(max_length=50) uuid = models.IntegerField(null=True) version = models.CharField(max_length=50, null=True) owner = models.ForeignK...
Create a Procedure model and an example Page model
Create a Procedure model and an example Page model Page only contains a foreign key to a procedure for now.
Python
bsd-3-clause
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
322cd948a7eef9d0af1d39de682c267094fb7324
test.py
test.py
import li import unittest class LIAPITestSequence(unittest.TestCase): def setup(self): pass def test_get_permits(self): """Returns the first 1,000 most recent permits as a list/JSON """ results = li.get_permits({}) self.assertEqual(type(results), list) self.a...
import li import unittest class LIAPITestSequence(unittest.TestCase): def setup(self): pass def test_get_permits(self): """Returns the first 1,000 most recent permits as a list/JSON """ results = li.get_permits({}) self.assertEqual(type(results), list) self.a...
Remove used of deprecated has_key() and replace with in
Remove used of deprecated has_key() and replace with in
Python
mit
AxisPhilly/py-li
9a0de77615c943de4344b4c74d5d5114b8baf0ab
eggsclaim.py
eggsclaim.py
import signal import sys import serial import sms from xbee import XBee egg_was_present = False def signal_handler(signal, frame): xbee.halt() serial_port.close() sys.exit(0) def packet_received(packet): samples = packet['samples'][0] egg_is_present = True if 'dio-4' in samples else False if...
import signal import sys import serial import sms from xbee import XBee egg_was_present = False def signal_handler(signal, frame): xbee.halt() serial_port.close() sys.exit(0) def packet_received(packet): samples = packet['samples'][0] egg_is_present = True if 'dio-4' in samples else False if...
Rearrange conditions to make logic clearer
Rearrange conditions to make logic clearer
Python
mit
jamespettigrew/eggsclaim
48418ac0fe75bbb331878b80d9d0903dde445838
setup.py
setup.py
from distutils.core import setup setup( name='pyticketswitch', version='1.6.1', author='Matt Jared', author_email='mattjared@ingresso.co.uk', packages=[ 'pyticketswitch', 'pyticketswitch.test', 'pyticketswitch.interface_objects' ], license='LICENSE.txt', descript...
from distutils.core import setup setup( name='pyticketswitch', version='1.6.1', author='Ingresso', author_email='systems@ingresso.co.uk', packages=[ 'pyticketswitch', 'pyticketswitch.test', 'pyticketswitch.interface_objects' ], license='LICENSE.txt', description=...
Update author and email address
Update author and email address
Python
mit
ingresso-group/pyticketswitch,ingtechteam/pyticketswitch,graingert/pyticketswitch
5782d01fa95624c784c6298486caefbe527fb76f
setup.py
setup.py
from distutils.core import setup from hal.version import __version__ as version setup( name='hal', packages=['hal'], version=version, description='Command Line Assistant', author='Anup Pokhrel', author_email='virtualanup@gmail.com', url='https://github.com/virtualanup/hal', download_ur...
from distutils.core import setup from hal.version import __version__ as version setup( name='hal-assistant', packages=['hal'], version=version, description='Command Line Assistant', author='Anup Pokhrel', author_email='virtualanup@gmail.com', url='https://github.com/virtualanup/hal', d...
Change package name to hal-assistant
Change package name to hal-assistant
Python
mit
virtualanup/hal
de5fbf7d63245e9d14844e66fdf16f88dbfae2e5
rest_framework/authtoken/migrations/0001_initial.py
rest_framework/authtoken/migrations/0001_initial.py
from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
Update initial migration to work on Python 3
Update initial migration to work on Python 3
Python
bsd-2-clause
ajaali/django-rest-framework,mgaitan/django-rest-framework,xiaotangyuan/django-rest-framework,wedaly/django-rest-framework,edx/django-rest-framework,uploadcare/django-rest-framework,brandoncazander/django-rest-framework,mgaitan/django-rest-framework,werthen/django-rest-framework,akalipetis/django-rest-framework,YBJAY00...
8e9fd28004c1f8daadc5ce7f51b40543c28720c0
djangoautoconf/settings_templates/smtp_account_template.py
djangoautoconf/settings_templates/smtp_account_template.py
__author__ = 'q19420' smtp_username = "test" smtp_password = "testpass"
__author__ = 'weijia' smtp_username = None smtp_password = None
Use None as username and password for SMTP.
Use None as username and password for SMTP.
Python
bsd-3-clause
weijia/djangoautoconf,weijia/djangoautoconf
60f87cb4c3523faf5c5cdbc5f16453cae755988b
angr/procedures/java_jni/GetArrayElements.py
angr/procedures/java_jni/GetArrayElements.py
from . import JNISimProcedure from ...engines.soot.values.arrayref import SimSootValue_ArrayRef class GetArrayElements(JNISimProcedure): return_ty = 'reference' def run(self, ptr_env, array, ptr_isCopy): array_ref = self.state.jni_references.lookup(array) values = self.load_java_array(self.st...
from . import JNISimProcedure from ...engines.soot.values.arrayref import SimSootValue_ArrayRef class GetArrayElements(JNISimProcedure): return_ty = 'reference' def run(self, ptr_env, array, ptr_isCopy): array_ref = self.state.jni_references.lookup(array) values = self.load_java_array(self.st...
Fix case if isCopy is null
Fix case if isCopy is null
Python
bsd-2-clause
schieb/angr,schieb/angr,angr/angr,angr/angr,iamahuman/angr,angr/angr,iamahuman/angr,schieb/angr,iamahuman/angr
36d7a5f754fef3bdab0103229fe8b5ee267f9376
scripts/urls-starting-with.py
scripts/urls-starting-with.py
import re import sys from xml.sax import make_parser, handler if len(sys.argv) < 3: print "This script expects two arguments: \n1. The path to a posts.xml file from a Stack Overflow data dump.\n2. A URL prefix to search for." else: start_with = sys.argv[2] class SOProcessor(handler.ContentHandler): ...
import re import sys from xml.sax import make_parser, handler if len(sys.argv) < 3: print "This script expects two arguments: \n1. The path to a posts.xml file from a Stack Overflow data dump.\n2. A URL prefix to search for." else: start_with = sys.argv[2] class SOProcessor(handler.ContentHandler): ...
Print tags out when scanning for URLs.
Print tags out when scanning for URLs.
Python
bsd-3-clause
alnorth/stackdoc,alnorth/stackdoc,alnorth/stackdoc
fe4f2fa1c64d40a15c49cc4183a59c912574fdff
ibmcnx/doc/DataSources.py
ibmcnx/doc/DataSources.py
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
Create script to save documentation to a file
4: Create script to save documentation to a file Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
ed59db63ab5832468b1348f6cd9bf00880fbbdbc
busstops/management/commands/import_areas.py
busstops/management/commands/import_areas.py
""" Import administrative areas from the NPTG. Usage: import_areas < AdminAreas.csv """ from ..import_from_csv import ImportFromCSVCommand from ...models import AdminArea class Command(ImportFromCSVCommand): def handle_row(self, row): AdminArea.objects.update_or_create( id=row['Adminis...
""" Import administrative areas from the NPTG. Usage: import_areas < AdminAreas.csv """ from ..import_from_csv import ImportFromCSVCommand from ...models import AdminArea class Command(ImportFromCSVCommand): def handle_row(self, row): AdminArea.objects.update_or_create( id=row['Adminis...
Move Cumbria to the North West
Move Cumbria to the North West
Python
mpl-2.0
jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,stev-0/bustimes.org.uk
c98ac4ca313606c966dc45dbe7861898177f2f04
api/tests/test_delete_bucket_list.py
api/tests/test_delete_bucket_list.py
import json from api.test import BaseTestCase from api.models import BucketList class TestDeleteBucketList(BaseTestCase): def test_delete_bucket_list(self): bucket_list_one = { "description": "Movies i have to watch by the end of the week", "status": "Pending", "title...
import json from api.test import BaseTestCase from api.models import BucketList class TestDeleteBucketList(BaseTestCase): def test_delete_bucket_list(self): bucket_list_one = { "description": "Movies i have to watch by the end of the week", "status": "Pending", "title...
Modify test to test that bucketlist nolonger exists in system
Modify test to test that bucketlist nolonger exists in system
Python
mit
EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list
ae2be1dc39baa8f8cd73e574d384619290b0c707
tests/api/views/users/read_test.py
tests/api/views/users/read_test.py
from tests.data import add_fixtures, users def test_read_user(db_session, client): john = users.john() add_fixtures(db_session, john) res = client.get('/users/{id}'.format(id=john.id)) assert res.status_code == 200 assert res.json == { u'id': john.id, u'firstName': u'John', ...
from skylines.model import Follower from tests.api import auth_for from tests.data import add_fixtures, users def test_read_user(db_session, client): john = users.john() add_fixtures(db_session, john) res = client.get('/users/{id}'.format(id=john.id)) assert res.status_code == 200 assert res.json...
Add more "GET /users/:id" tests
tests/api: Add more "GET /users/:id" tests
Python
agpl-3.0
Turbo87/skylines,skylines-project/skylines,shadowoneau/skylines,Harry-R/skylines,shadowoneau/skylines,RBE-Avionik/skylines,skylines-project/skylines,RBE-Avionik/skylines,Turbo87/skylines,RBE-Avionik/skylines,shadowoneau/skylines,Harry-R/skylines,Turbo87/skylines,skylines-project/skylines,Harry-R/skylines,Harry-R/skylin...
4b488c8d0842bb25c719fcd93ee0ae46978b5680
meta/util.py
meta/util.py
import os import sys import time import math from contextlib import contextmanager @contextmanager def timeit_msg(msg): print '{}...'.format(msg), sys.stdout.flush() start = time.time() yield stop = time.time() print ' ({:1.3f} s)'.format((stop-start)) def get_file_size(fname): fstats = os.stat(fname) size ...
import os import sys import time import math import sqlite3 from contextlib import contextmanager import meta @contextmanager def timeit_msg(msg): print '{}...'.format(msg), sys.stdout.flush() start = time.time() yield stop = time.time() print ' ({:1.3f} s)'.format((stop-start)) def get_file_size(fname): fs...
Add support for connecting to NCBI database
Add support for connecting to NCBI database
Python
mit
abulovic/pgnd-meta
dac3cedaee583db4cc3c05a9cb2c4f15a707123e
pylib/mapit/middleware.py
pylib/mapit/middleware.py
import re class JSONPMiddleware(object): def process_response(self, request, response): if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')): response.content = request.GET.get('callback') + '(' + response.content + ')' return response
import re class JSONPMiddleware(object): def process_response(self, request, response): if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')): response.content = request.GET.get('callback') + '(' + response.content + ')' response.status_code = 20...
Set up JSONP requests to always return 200.
Set up JSONP requests to always return 200.
Python
agpl-3.0
Sinar/mapit,Code4SA/mapit,New-Bamboo/mapit,opencorato/mapit,Sinar/mapit,opencorato/mapit,opencorato/mapit,chris48s/mapit,chris48s/mapit,Code4SA/mapit,chris48s/mapit,New-Bamboo/mapit,Code4SA/mapit
c80893c5789998b6d6068703bb2434919abc65a3
sqjobs/tests/django_test.py
sqjobs/tests/django_test.py
#!/usr/bin/env python import os import sys from django.conf import settings import django DEFAULT_SETTINGS = { 'INSTALLED_APPS': ( 'sqjobs', 'sqjobs.tests', 'sqjobs.contrib.django.djsqjobs' ), 'DATABASES': { 'default': { 'ENGINE': 'django.db.backends.sqlite3', ...
#!/usr/bin/env python import os import sys from django.conf import settings import django DEFAULT_SETTINGS = { 'INSTALLED_APPS': ( 'sqjobs', 'sqjobs.tests', 'sqjobs.contrib.django.djsqjobs' ), 'DATABASES': { 'default': { 'ENGINE': 'django.db.backends.sqlite3', ...
Return status when executing tests with DiscoverRunner
Return status when executing tests with DiscoverRunner
Python
bsd-3-clause
gnufede/sqjobs,gnufede/sqjobs