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
ac403cc68eac59c918ce83d48dc1beb98ddd3484
pystil/__init__.py
pystil/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 by Florian Mounier, Kozea # This file is part of pystil, licensed under a 3-clause BSD license. """ pystil - An elegant site web traffic analyzer """ from flask import Flask from logging import getLogger, INFO from pystil.log import get_default_handler ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 by Florian Mounier, Kozea # This file is part of pystil, licensed under a 3-clause BSD license. """ pystil - An elegant site web traffic analyzer """ from flask import Flask from logging import getLogger, INFO from pystil.log import get_default_handler ...
Use __file__ for static and templates
Use __file__ for static and templates
Python
bsd-3-clause
Kozea/pystil,Kozea/pystil,Kozea/pystil,Kozea/pystil,Kozea/pystil
a8bf783c99691d12acc9298a67b09a857bed755e
tests/test_oai_harvester.py
tests/test_oai_harvester.py
from __future__ import unicode_literals from scrapi.base import OAIHarvester from scrapi.linter import RawDocument from .utils import TEST_OAI_DOC class TestHarvester(OAIHarvester): base_url = '' long_name = 'Test' short_name = 'test' url = 'test' property_list = ['type', 'source', 'publisher', ...
from __future__ import unicode_literals import httpretty from scrapi.base import OAIHarvester from scrapi.linter import RawDocument from .utils import TEST_OAI_DOC class TestHarvester(OAIHarvester): base_url = '' long_name = 'Test' short_name = 'test' url = 'test' property_list = ['type', 'sour...
Add more robust test harvester harvest method with mocking
Add more robust test harvester harvest method with mocking
Python
apache-2.0
icereval/scrapi,mehanig/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,felliott/scrapi,alexgarciac/scrapi,ostwald/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,mehanig/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi
d446a634cf2d903b8f7a7964210017065ffb9b9a
tests/test_xorshift_rand.py
tests/test_xorshift_rand.py
# Copyright 2014 Anonymous7 from Reddit, Julian Andrews # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. from __future__ import absolute_import, division import collections import unittest from eval7 import xorshift_rand class XorshiftRandTe...
# Copyright 2014 Anonymous7 from Reddit, Julian Andrews # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. from __future__ import absolute_import, division import collections import unittest from eval7 import xorshift_rand class XorshiftRandTe...
Increase delta to reduce chance of random failure
Increase delta to reduce chance of random failure Exact chance of failure is more trouble to calculate than I care to go to, but the the old chance of failure was likely somewhere in the 1-10% range. The purpose of the test is to detect meaningful non-uniformity, so false positives should be kept rare.
Python
mit
JulianAndrews/pyeval7,JulianAndrews/pyeval7
b7433c0d18a01a9e1340123f7c0423d1fdec04a3
sphinxdoc/urls.py
sphinxdoc/urls.py
# encoding: utf-8 """ URL conf for django-sphinxdoc. """ from django.conf.urls.defaults import patterns, url from django.views.generic import list_detail from sphinxdoc import models from sphinxdoc.views import ProjectSearchView project_info = { 'queryset': models.Project.objects.all().order_by('name'), 'te...
# encoding: utf-8 """ URL conf for django-sphinxdoc. """ from django.conf.urls.defaults import patterns, url from django.views.generic.list import ListView from sphinxdoc import models from sphinxdoc.views import ProjectSearchView urlpatterns = patterns('sphinxdoc.views', url( r'^$', ListView.as...
Change function-based generic view to class-based.
Change function-based generic view to class-based. As per their deprecation policy, Django 1.5 removed function-based generic views.
Python
mit
kamni/django-sphinxdoc
31fc3b8c9fd2f0c7f10e14078fca2e7cd43ac4b1
lifelines/tests/__main__.py
lifelines/tests/__main__.py
import pytest if __name__ == '__main__': pytest.main("--pyargs lifelines.tests")
import sys import pytest if __name__ == '__main__': # Exit with correct code sys.exit(pytest.main("--pyargs lifelines.tests"))
Exit with correct error code after tests
Exit with correct error code after tests Signed-off-by: Jonas Kalderstam <35a2c6fae61f8077aab61faa4019722abf05093c@kalderstam.se>
Python
mit
wavelets/lifelines,jstoxrocky/lifelines,nerdless/lifelines,CamDavidsonPilon/lifelines
98516d4fa4a7f56e5133377b228ac8c90aed74c9
magnum/tests/fake_policy.py
magnum/tests/fake_policy.py
# Copyright (c) 2012 OpenStack Foundation # # 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 t...
# Copyright (c) 2012 OpenStack Foundation # # 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 t...
Clean rc from unit tests
Clean rc from unit tests Magnum have removed the k8s rc apis, but have not removed it from policy.json. The patch (https://review.openstack.org/#/c/384064/) remove rc from etc/magnum/policy.json. And we should remove rc from tests/fake_policy.py. Change-Id: Ia98e1637f2e3a5919be3784322a55005970d4da8
Python
apache-2.0
openstack/magnum,ArchiFleKs/magnum,ArchiFleKs/magnum,openstack/magnum
08652630865a706126ac61420edb55298296d2eb
abilian/services/__init__.py
abilian/services/__init__.py
""" Modules that provide services. They are implemented as Flask extensions (see: http://flask.pocoo.org/docs/extensiondev/ ) """ __all__ = ['Service', 'ServiceState', 'audit_service', 'index_service', 'activity_service', 'auth_service'] from .base import Service, ServiceState # Homegrown extensions. fro...
""" Modules that provide services. They are implemented as Flask extensions (see: http://flask.pocoo.org/docs/extensiondev/ ) """ from flask import current_app from .base import Service, ServiceState # Homegrown extensions. from .audit import audit_service from .indexing import service as index_service from .conver...
Add a get_service convenience method.
Add a get_service convenience method.
Python
lgpl-2.1
abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core
0b9d3dbfca2fa54444e8d95b1c63ecf3e726ee5b
sso/middleware.py
sso/middleware.py
class IGBMiddleware(object): """ Middleware to detect the EVE IGB """ def process_request(self, request): request.is_igb = False request.is_igb_trusted = False if request.META.has_key('HTTP_EVE_TRUSTED'): request.is_igb = True if request.META.get('HTTP...
class IGBMiddleware(object): """ Middleware to detect the EVE IGB """ def process_request(self, request): request.is_igb = False request.is_igb_trusted = False header_map = [ ('HTTP_EVE_SERVERIP', 'eve_server_ip'), ('HTTP_EVE_CHARNAME', 'eve_charname')...
Expand the IGB Middleware to map headers into the request object
Expand the IGB Middleware to map headers into the request object
Python
bsd-3-clause
nikdoof/test-auth
c716124b8ede9678ca24eb07f1aa83c1fba9f177
doorman/celery_serializer.py
doorman/celery_serializer.py
# -*- coding: utf-8 -*- from datetime import datetime from time import mktime import json class DJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, datetime): return { '__type__': '__datetime__', 'epoch': int(mktime(obj.timetuple())) ...
# -*- coding: utf-8 -*- from datetime import datetime from time import mktime import json from doorman.compat import string_types class DJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, datetime): return { '__type__': '__datetime__', 'e...
Fix custom decoder on Python 3
Fix custom decoder on Python 3
Python
mit
mwielgoszewski/doorman,mwielgoszewski/doorman,mwielgoszewski/doorman,mwielgoszewski/doorman
70b23dbd315b93213fc62540aab6293665b9dd0c
pebble_tool/sdk/__init__.py
pebble_tool/sdk/__init__.py
from __future__ import absolute_import __author__ = 'katharine' import os import subprocess from pebble_tool.exceptions import MissingSDK from pebble_tool.util import get_persist_dir def sdk_path(): path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')...
from __future__ import absolute_import __author__ = 'katharine' import os import subprocess from pebble_tool.exceptions import MissingSDK from pebble_tool.util import get_persist_dir def sdk_path(): path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')...
Fix error determining current version in other working directories.
Fix error determining current version in other working directories.
Python
mit
pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool
79cbfc35ecca75434cf31839416e5866bad7909d
app/__init__.py
app/__init__.py
import logging logging.basicConfig( format='%(asctime)s %(levelname)-8s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')
import logging logging.root.handlers = [] logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO, filename='triggear.log') console = logging.StreamHandler() console.setLevel(logging.WARNING) logg...
Add logging to file on side of logging to stdout
Add logging to file on side of logging to stdout
Python
mit
futuresimple/triggear
b9fc50abab64f784c8d6defb74aaaf5bdb5a45a7
src/python/main.py
src/python/main.py
"""Script to act as a template""" import os import sys def main(args): return os.EX_OK if __name__ == '__main__': sys.exit(main(sys.argv[1:]))
#! /usr/bin/env python2 """Script to act as a template""" import os import sys def main(_args): return os.EX_OK if __name__ == '__main__': sys.exit(main(sys.argv[1:]))
Hide variable till something actually uses it
Hide variable till something actually uses it
Python
mit
jalanb/jab,jalanb/dotjab,jalanb/dotjab,jalanb/jab
e9df4039849e88433f75869b8b6997f21726e761
blog/myblog/views.py
blog/myblog/views.py
from django.shortcuts import render, get_object_or_404, HttpResponseRedirect, HttpResponse from myblog.models import Article from django.views.decorators.csrf import csrf_exempt from django.utils import timezone from django.core.urlresolvers import reverse def index(request): latest_articles = Article.objects.fil...
from django.shortcuts import render, get_object_or_404, HttpResponseRedirect, HttpResponse from myblog.models import Article from django.views.decorators.csrf import csrf_exempt from django.utils import timezone from django.core.urlresolvers import reverse def index(request): latest_articles = Article.objects.fil...
Add more text in jumbotron
Add more text in jumbotron
Python
mit
mileto94/Django-tutorial,mileto94/Django-tutorial
7297f61674d37795f3d63ec990f87e9950d68456
salt/utils/yamldumper.py
salt/utils/yamldumper.py
# -*- coding: utf-8 -*- ''' salt.utils.yamldumper ~~~~~~~~~~~~~~~~~~~~~ ''' # pylint: disable=W0232 # class has no __init__ method from __future__ import absolute_import try: from yaml import CDumper as Dumper from yaml import CSafeDumper as SafeDumper except ImportError: from yaml import ...
# -*- coding: utf-8 -*- ''' salt.utils.yamldumper ~~~~~~~~~~~~~~~~~~~~~ ''' # pylint: disable=W0232 # class has no __init__ method from __future__ import absolute_import try: from yaml import CDumper as Dumper from yaml import CSafeDumper as SafeDumper except ImportError: from yaml import ...
Check for ioflo-flavored OrderedDicts as well when outputting YAML
Check for ioflo-flavored OrderedDicts as well when outputting YAML
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
44f603cd947f63101cf6b7eb8e49b5210cfa4f6f
wry/__init__.py
wry/__init__.py
#!/usr/bin/env python2 # 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, softwa...
#!/usr/bin/env python2 # 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, softwa...
Add version. Note this will cause the file to be modified in your working copy. This change is gitignored
Add version. Note this will cause the file to be modified in your working copy. This change is gitignored
Python
apache-2.0
ocadotechnology/wry
ddb91c20793d8e5e8a01e0302afeaaba76776741
setuptools/extern/six.py
setuptools/extern/six.py
""" Handle loading six package from system or from the bundled copy """ import imp _SIX_SEARCH_PATH = ['setuptools._vendor.six', 'six'] def _find_module(name, path=None): """ Alternative to `imp.find_module` that can also search in subpackages. """ parts = name.split('.') for part in parts: ...
""" Handle loading a package from system or from the bundled copy """ import imp _SEARCH_PATH = ['setuptools._vendor.six', 'six'] def _find_module(name, path=None): """ Alternative to `imp.find_module` that can also search in subpackages. """ parts = name.split('.') for part in parts: ...
Make the technique even more generic
Make the technique even more generic --HG-- branch : feature/issue-229
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
88ae237911346d74c1c8a51a11dd47b486f3b4c5
setuptools/py31compat.py
setuptools/py31compat.py
try: # Python >=3.2 from tempfile import TemporaryDirectory except ImportError: import shutil import tempfile class TemporaryDirectory(object): """ Very simple temporary directory context manager. Will try to delete afterward, but will also ignore OS and similar erro...
__all__ = [] try: # Python >=3.2 from tempfile import TemporaryDirectory except ImportError: import shutil import tempfile class TemporaryDirectory(object): """ Very simple temporary directory context manager. Will try to delete afterward, but will also ignore OS and simila...
Make it clear this compat module provides no public members
Make it clear this compat module provides no public members
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
3849a5a842137a29ce06b5b7e027c8f8efd4e00e
shopify/product/admin.py
shopify/product/admin.py
from django.contrib import admin from .models import Product class ProductAdmin(admin.ModelAdmin): list_display = ('description', 'product_type', 'account_number') ordering = ('description',) class Meta: model = Product admin.site.register(Product, ProductAdmin)
from django.contrib import admin from .models import Product class ProductAdmin(admin.ModelAdmin): list_display = ('description', 'product_type', 'account_number') ordering = ('description',) readonly_fields = ('description', 'product_type', 'product_id') class Meta: model = Product admin....
Make Shopify product fields readonly
Make Shopify product fields readonly
Python
bsd-3-clause
CorbanU/corban-shopify,CorbanU/corban-shopify
49f3c5bf5b95a7d678e541d93e0999f37f8a2b26
students/admin.py
students/admin.py
from django.contrib import admin from .models import WhitelistedUsername class WhitelistedUsernameAdmin(admin.ModelAdmin): pass admin.site.register(WhitelistedUsername, WhitelistedUsernameAdmin)
from django.contrib import admin from .models import WhitelistedUsername @admin.register(WhitelistedUsername) class WhitelistedUsernameAdmin(admin.ModelAdmin): pass
Use class decorator instead of floating statement to register WhitelistedUsernameAdmin class.
Use class decorator instead of floating statement to register WhitelistedUsernameAdmin class.
Python
mit
muhummadPatel/raspied,muhummadPatel/raspied,muhummadPatel/raspied
fde84efc866d2276eac5faed0af3df5a672664f5
fabfile.py
fabfile.py
from fabric.api import * from fabric.colors import * env.colorize_errors = True env.hosts = ['sanaprotocolbuilder.me'] env.user = 'root' env.virtualenv = 'source /usr/local/bin/virtualenvwrapper.sh' env.project_root = '/opt/sana.protocol_builder' def test(): local('python sana_builder...
from fabric.api import * from fabric.colors import * env.colorize_errors = True env.hosts = ['sanaprotocolbuilder.me'] env.user = 'root' env.virtualenv = 'source /usr/local/bin/virtualenvwrapper.sh' env.project_root = '/opt/sana.protocol_builder' def test(): local('python sana_builder...
Remove input from fab test
Remove input from fab test
Python
bsd-3-clause
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
3309fd5058294a9ee340fd3130d45711270b3062
daymetpy/__init__.py
daymetpy/__init__.py
__version__ = '0.0.2' from daymetpy import daymet_timeseries __all__ = ["daymet_timeseries"]
__version__ = '0.0.2' try: from daymetpy import daymet_timeseries except ImportError: from daymetpy.daymetpy import daymet_timeseries __all__ = ["daymet_timeseries"]
Change to imports for 2-3 compatibility
Change to imports for 2-3 compatibility
Python
agpl-3.0
khufkens/daymetpy
1001a61d345e1b3018eccfbd1cdb4a2111e23cca
example.py
example.py
import pyrc import pyrc.utils.hooks as hooks class GangstaBot(pyrc.Bot): @hooks.command() def bling(self, target, sender): "will print yo" if target.startswith("#"): self.message(target, "%s: yo" % sender) else: self.message(target, "yo") @hooks.command("^repeat\s+(?P<msg>.+)$") def re...
import pyrc import pyrc.utils.hooks as hooks class GangstaBot(pyrc.Bot): @hooks.command() def info(self, target, sender): "will print the target and sender to the console" print("target: %s, sender: %s" % (target, sender)) @hooks.command() def bling(self, target, sender): "will print yo" if ta...
Fix bling() and add in info function to report target & sender.
Fix bling() and add in info function to report target & sender.
Python
mit
sarenji/pyrc
0607ff6a3a787286b174af1cb441eb1d1447b634
fabfile.py
fabfile.py
import os from fabric.api import * LOCAL_ROOT = os.path.dirname(os.path.realpath(__file__)) LOCAL_VIRTUALENV = '~/.virtualenv/tomo' TOMO_HOST = 'www.projekt-tomo.si' env.hosts = [TOMO_HOST] # MAIN TASKS @task def test(): with lcd(LOCAL_ROOT), activate_virtualenv(): with lcd('web'): local('....
import os from fabric.api import * LOCAL_ROOT = os.path.dirname(os.path.realpath(__file__)) LOCAL_VIRTUALENV = '~/.virtualenv/tomo' TOMO_HOST = 'www.projekt-tomo.si' env.hosts = [TOMO_HOST] # MAIN TASKS @task def test(): with lcd(LOCAL_ROOT), activate_virtualenv(): with lcd('web'): local('....
Enable quick deploys in fabric
Enable quick deploys in fabric
Python
agpl-3.0
matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo
2f3ffa846c67f9b746855f1f9ec39d861a3e95b9
libraries/vytree/__init__.py
libraries/vytree/__init__.py
# vytree.__init__: package init file. # # Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net> # # This library 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 # ver...
# vytree.__init__: package init file. # # Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net> # # This library 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 # ver...
Add reference tree loader to imports.
Add reference tree loader to imports.
Python
lgpl-2.1
vyos-legacy/vyconfd,vyos-legacy/vyconfd
3ccfed2e70e6da68452d466353c7b0df1ff9811c
cricinfo/my_bot.py
cricinfo/my_bot.py
import requests from bs4 import BeautifulSoup CRICINFO_RSS_URL = 'http://static.cricinfo.com/rss/livescores.xml' # Fetching matches def get_matches(): r = requests.get(CRICINFO_RSS_URL) soup = BeautifulSoup(r.text) return soup.find_all('item') matches = get_matches() for match in matches: print match.contents...
import requests from bs4 import BeautifulSoup import xmltodict import click CRICINFO_RSS_URL = 'http://static.cricinfo.com/rss/livescores.xml' class Match(object): def __init__(self, title, link, description, guid): self.title = title self.link = link self.description = description self.guid = guid @st...
Add fetching live scores feature
Add fetching live scores feature
Python
mit
voidabhi/cricinfo,voidabhi/cricinfo
0b82789823dbfa1fc74af0eee7b8911783519f91
scripts/starting_py_program.py
scripts/starting_py_program.py
#!/usr/bin/env python3 # from __future__ import print_function #(if python2) import sys def eprint(*args, **kwargs): """ Just like the print function, but on stderr """ print(*args, file=sys.stderr, **kwargs) def main(argv=None): """ Program starting point, it can started by the OS or as normal fun...
#!/usr/bin/env python3 # from __future__ import print_function #(if python2) import sys import os def eprint(*args, **kwargs): """ Just like the print function, but on stderr """ print(*args, file=sys.stderr, **kwargs) def main(argv=None): """ Program starting point, it can started by the OS or as ...
Add the program name to starting py
Add the program name to starting py
Python
unlicense
paolobolzoni/useful-conf,paolobolzoni/useful-conf,paolobolzoni/useful-conf
edd6368f4b21372e268adef04b9beb85d5603f40
txircd/modules/cmd_names.py
txircd/modules/cmd_names.py
from twisted.words.protocols import irc from txircd.modbase import Command class NamesCommand(Command): def onUse(self, user, data): for chan in data["targetchan"]: user.report_names(chan) def processParams(self, user, params): if user.registered > 0: user.sendMessage(irc.ERR_NOTREGISTERED, "NAMES", ":Yo...
from twisted.words.protocols import irc from txircd.modbase import Command class NamesCommand(Command): def onUse(self, user, data): for chan in data["targetchan"]: user.report_names(chan) def processParams(self, user, params): if user.registered > 0: user.sendMessage(irc.ERR_NOTREGISTERED, "NAMES", ":Yo...
Send "no such channel" message on NAMES with a nonexistent channel
Send "no such channel" message on NAMES with a nonexistent channel
Python
bsd-3-clause
ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd
0adf184e841bedffa118e85eda94ff099862cb6f
examsys/urls.py
examsys/urls.py
from django.conf.urls import patterns, url from examsys import views urlpatterns = patterns('', # (r'^$', lambda r: HttpResponseRedirect('examsys/')) url(r'^$', views.index, name='index'), url(r'^login/', views.login, name='login'), url(r'^logout/', views.logout, name='logout'), url(r'^register/', v...
from django.conf.urls import patterns, url from examsys import views urlpatterns = patterns('', # (r'^$', lambda r: HttpResponseRedirect('examsys/')) url(r'^$', views.index, name='index'), url(r'^login/', views.login, name='login'), url(r'^logout/', views.logout, name='logout'), url(r'^register/', v...
Add the choose test and take test to URLs
Add the choose test and take test to URLs
Python
mit
icyflame/test-taking-platform,icyflame/test-taking-platform
10e4efb1b28eb6b32f0cef3eee510f9a6e0b6909
src/foremast/plugin_manager.py
src/foremast/plugin_manager.py
"""Manager to handle plugins""" import pathlib from pluginbase import PluginBase from .exceptions import PluginNotFound class PluginManager: """Class to manage and create Spinnaker applications Args: paths (str): Path of plugin directory. provider (str): The name of the cloud provider. ...
"""Manager to handle plugins""" import pathlib from pluginbase import PluginBase from .exceptions import PluginNotFound class PluginManager: """Class to manage and create Spinnaker applications Args: paths (str): Path of plugin directory. provider (str): The name of the cloud provider. ...
Rename parameter to more appropriate name
fix: Rename parameter to more appropriate name
Python
apache-2.0
gogoair/foremast,gogoair/foremast
98acdc9262cfa8c5da092e0c3b1264afdcbde66a
locations/spiders/speedway.py
locations/spiders/speedway.py
# -*- coding: utf-8 -*- import scrapy import json from locations.items import GeojsonPointItem class SuperAmericaSpider(scrapy.Spider): name = "superamerica" allowed_domains = ["superamerica.com"] start_urls = ( 'https://www.speedway.com/GasPriceSearch', ) def parse(self, response): ...
# -*- coding: utf-8 -*- import scrapy import json from locations.items import GeojsonPointItem class SuperAmericaSpider(scrapy.Spider): name = "speedway" allowed_domains = ["www.speedway.com"] start_urls = ( 'https://www.speedway.com/GasPriceSearch', ) def parse(self, response): ...
Correct the name of the spider
Correct the name of the spider
Python
mit
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
19e26d09659dc4db6bcd27565dacd458b7e3e4cd
symposion/proposals/management/commands/ensure_proposal_records.py
symposion/proposals/management/commands/ensure_proposal_records.py
""" Management command to make sure the permissions exist for all kinds of proposals. """ from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): def handle_noargs(self, **options): from symposion.proposals.kinds import ensure_proposal_records ensure_proposal_records(...
""" Management command to make sure the permissions exist for all kinds of proposals. """ from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): from symposion.proposals.kinds import ensure_proposal_records ensure_proposal_records()
Use BaseCommand instead of NoArgsCommand
Use BaseCommand instead of NoArgsCommand
Python
bsd-3-clause
PyCon/pycon,njl/pycon,njl/pycon,njl/pycon,PyCon/pycon,njl/pycon,PyCon/pycon,PyCon/pycon
298a90c942bd44f920e1b12ea0af384b7f06c6f1
gitless/cli/gl_switch.py
gitless/cli/gl_switch.py
# -*- coding: utf-8 -*- # Gitless - a version control system built on top of Git. # Licensed under GNU GPL v2. """gl switch - Switch branches.""" from __future__ import unicode_literals from . import pprint def parser(subparsers, _): """Adds the switch parser to the given subparsers object.""" desc = 'switch ...
# -*- coding: utf-8 -*- # Gitless - a version control system built on top of Git. # Licensed under GNU GPL v2. """gl switch - Switch branches.""" from __future__ import unicode_literals from . import pprint def parser(subparsers, _): """Adds the switch parser to the given subparsers object.""" desc = 'switch ...
Make `switch` command a bit more helpful
Make `switch` command a bit more helpful
Python
mit
sdg-mit/gitless,sdg-mit/gitless
6bf1bceebc9acc724dd9831554ea582eabf82d08
tools/telemetry/telemetry/core/chrome/inspector_memory_unittest.py
tools/telemetry/telemetry/core/chrome/inspector_memory_unittest.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. import os from telemetry.test import tab_test_case class InspectorMemoryTest(tab_test_case.TabTestCase): def testGetDOMStats(self): unittest_data_...
# 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. import os from telemetry.test import tab_test_case class InspectorMemoryTest(tab_test_case.TabTestCase): def testGetDOMStats(self): unittest_data_...
Fix InspectorMemoryTest.testGetDOMStats to have consistent behaviour on CrOS and desktop versions of Chrome. Starting the browser in CrOS requires navigating through an initial setup that does not leave us with a tab at "chrome://newtab". This workaround runs the test in a new tab on all platforms for consistency.
Fix InspectorMemoryTest.testGetDOMStats to have consistent behaviour on CrOS and desktop versions of Chrome. Starting the browser in CrOS requires navigating through an initial setup that does not leave us with a tab at "chrome://newtab". This workaround runs the test in a new tab on all platforms for consistency. BUG...
Python
bsd-3-clause
pozdnyakov/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,anirudhSK/chromium,anirudhSK/chromium,pozdnyakov/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,Chilledheart/chromium,markYoungH/chromium.src,bright-sparks/chromium-spacewalk,Jonekee/chromium.src,anirudhSK/chromium,Just-D/chromium-1,hgl888...
243523ee5e70a94914de23d8444478425b7bb782
alg_topological_sort.py
alg_topological_sort.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division def topological_sort(): """Topological Sorting for Directed Acyclic Graph (DAG).""" pass def main(): # DAG. dag_adjacency_dict = { 'A': ['D'], 'B': ['D'], 'C': ['D'], ...
from __future__ import absolute_import from __future__ import print_function from __future__ import division def _previsit(): pass def _postvisit(): pass def _dfs_explore(): pass def topological_sort(): """Topological Sorting for Directed Acyclic Graph (DAG). To topologically sort a DAG, we si...
Add helper methods and revise doc string
Add helper methods and revise doc string
Python
bsd-2-clause
bowen0701/algorithms_data_structures
36593f21c93a16beb5d2ab77ba803a9059099615
phillydata/waterdept/load.py
phillydata/waterdept/load.py
import os from django.contrib.gis.utils import LayerMapping from ..load import get_processed_data_file from .models import WaterParcel, waterparcel_mapping def from_shapefile(transaction_mode='autocommit', **kwargs): """ Load water parcel data into the database from the processed shapefile. """ # Us...
import os from django.contrib.gis.utils import LayerMapping from ..load import get_processed_data_file from .models import WaterAccount, WaterParcel, waterparcel_mapping def from_shapefile(transaction_mode='autocommit', **kwargs): """ Load water parcel data into the database from the processed shapefile. ...
Fix WaterAccount instances pointing to old WaterParcels
Fix WaterAccount instances pointing to old WaterParcels Start to make older WaterParcels obsolete
Python
bsd-3-clause
ebrelsford/django-phillydata
342d3791aa80084309ffc00a9e5e936fa8277401
AFQ/viz.py
AFQ/viz.py
import tempfile import os.path as op import numpy as np import IPython.display as display import nibabel as nib from dipy.viz import fvtk from palettable.tableau import Tableau_20 def visualize_bundles(trk, ren=None, inline=True, interact=False): """ Visualize bundles in 3D using fvtk """ if isinst...
import tempfile import os.path as op import numpy as np import IPython.display as display import nibabel as nib from dipy.viz import fvtk from dipy.viz.colormap import line_colors from palettable.tableau import Tableau_20 def visualize_bundles(trk, ren=None, inline=True, interact=False): """ Visualize bundl...
Enable visualizing trk files without bundle designations.
Enable visualizing trk files without bundle designations.
Python
bsd-2-clause
yeatmanlab/pyAFQ,arokem/pyAFQ,yeatmanlab/pyAFQ,arokem/pyAFQ
7ad1d9afdbf8db2960ac6b402f4da3f1675cc86f
fileupload/models.py
fileupload/models.py
from django.db import models class Picture(models.Model): """ This is a small demo using just two fields. ImageField depends on PIL or pillow (where Pillow is easily installable in a virtualenv. If you have problems installing pillow, use a more generic FileField instead. """ picture_file = m...
from django.db import models class Picture(models.Model): """ This is a small demo using just two fields. ImageField depends on PIL or pillow (where Pillow is easily installable in a virtualenv. If you have problems installing pillow, use a more generic FileField instead. """ file = models.Im...
Use the same name for the field in frontend and backend
Use the same name for the field in frontend and backend
Python
mit
sigurdga/django-dropzone-upload,sigurdga/django-dropzone-upload
eaa75a86a3ea64e2c98dbcdd0a0b9731c9505abf
sts/contextmanagers.py
sts/contextmanagers.py
from .models import System class transition(object): "Transition context manager." def __init__(self, obj, state, event=None, start_time=None, message=None, exception_fail=True): self.system = System.get(obj) self.transition = self.system.start_transition(event=event, ...
from .models import System class transition(object): "Transition context manager." def __init__(self, obj, state, event=None, start_time=None, message=None, exception_fail=True, fail_state='Fail'): self.system = System.get(obj) self.transition = self.system.start_transition(event=...
Add back fail_state to context manager
Add back fail_state to context manager
Python
bsd-3-clause
chop-dbhi/django-sts,chop-dbhi/django-sts
35f2838d1451681f1cc49fba3b4466389bf2cf68
test/test_allocator.py
test/test_allocator.py
from support import lib,ffi from qcgc_test import QCGCTest class AllocatorTest(QCGCTest): def test_cells_to_bytes(self): for i in range(1,17): self.assertEqual(1, lib.bytes_to_cells(i)) self.assertEqual(2, lib.bytes_to_cells(17))
from support import lib,ffi from qcgc_test import QCGCTest class AllocatorTest(QCGCTest): def test_cells_to_bytes(self): for i in range(1,17): self.assertEqual(1, lib.bytes_to_cells(i)) self.assertEqual(2, lib.bytes_to_cells(17)) def test_init_values(self): self.assertNotEq...
Add testcase for allocator initialization
Add testcase for allocator initialization
Python
mit
ntruessel/qcgc,ntruessel/qcgc,ntruessel/qcgc
928d1d8aab846e9393f925690bd1f51f327fb5ad
test_arrange_schedule.py
test_arrange_schedule.py
from arrange_schedule import * def test_read_system_setting(): keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] system_setting = read_system_setting() for key in keys: assert key in system_setting return system_setting def test_read_arrange_mode(): keys = ['arrange_sn','a...
from arrange_schedule import * def test_read_system_setting(): keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] system_setting = read_system_setting() for key in keys: assert key in system_setting return system_setting def test_read_arrange_mode(): keys = ['arrange_sn','a...
Add test case for forum crawler
Add test case for forum crawler The forum include: 'inside', 'techorange', 'media'
Python
apache-2.0
stvreumi/electronic-blackboard,chenyang14/electronic-blackboard,SWLBot/electronic-blackboard,SWLBot/electronic-blackboard,Billy4195/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,stvreumi/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,chenyang14/elec...
d855e5626ee639a237467af7f6f57947cd17f9c4
user_messages/views.py
user_messages/views.py
from django.contrib.auth.decorators import login_required from django.db.models import Q from django.shortcuts import get_object_or_404 from django.template import RequestContext from user_messages.models import Thread, Message @login_required def inbox(request, template_name='user_messages/inbox.html'): threads ...
from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.template import RequestContext from user_messages.forms import MessageReplyForm f...
Add reply support to threads
Add reply support to threads
Python
mit
pinax/pinax-messages,arthur-wsw/pinax-messages,arthur-wsw/pinax-messages,eldarion/user_messages,pinax/pinax-messages,eldarion/user_messages
c2dbfc7f18dc44747fbb8b14e212cbb4151e8f85
analyze.py
analyze.py
import fore.database analysis = fore.database.get_analysis(2) import pickle, base64 analysis = pickle.loads(base64.b64decode(analysis)) print(analysis)
import sys import fore.database if len(sys.argv) > 1: track_no = sys.argv[1] else: track_no = 2 analysis = fore.database.get_analysis(track_no) import pickle, base64 analysis = pickle.loads(base64.b64decode(analysis)) print(analysis)
Send track number as CLI argument.
Send track number as CLI argument.
Python
artistic-2.0
MikeiLL/appension,Rosuav/appension,MikeiLL/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension,MikeiLL/appension,Rosuav/appension
a3dd1f1c358ab8be7987f9e93ff4f2c0351ae43e
porick/views.py
porick/views.py
from flask import render_template, g from porick import app, model @app.route('/') def landing_page(): return render_template('/index.html') @app.route('/browse') @app.route('/browse/<area>') @app.route('/browse/<area>/page/<page>') def browse(area=None, page=None): raise NotImplementedError() @app.route(...
from flask import render_template, g from porick import app, model @app.route('/') def landing_page(): return render_template('/index.html') @app.route('/browse') @app.route('/browse/<int:quote_id>') @app.route('/browse/<area>') @app.route('/browse/<area>/page/<page>') def browse(area=None, page=None): rai...
Add route for individual quote
Add route for individual quote
Python
apache-2.0
stesh/porick-flask,stesh/porick-flask,stesh/porick-flask
2046d82addab9ec83dbb85a2d08c727a52065d8b
deckglue/models.py
deckglue/models.py
from django.db import models # Create your models here.
from django.contrib.auth.models import Permission from django.db.models.signals import post_save, pre_delete from django.dispatch import receiver from cardbox.card_model import Card from cardbox.deck_model import Deck from guardian.shortcuts import assign_perm, get_users_with_perms from guardian.models import UserOb...
Add signal hooks to create practice objects
Add signal hooks to create practice objects
Python
mit
DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune
76c193f457bb45e8e821594de67da8e15c4352d4
product.py
product.py
from datetime import datetime class Product(): def __init__(self, cost, name, date): self.cost = cost self.name = name self.date = date def days_left(self): return datetime.now() - self.date
from datetime import datetime class Product(): def __init__(self, cost, name, date): self.cost = cost self.name = name self.date = date self.passed_phases = set() def days_left(self): return datetime.now() - self.date if __name__ == '__main__': main() def main()...
Add passed_phases to Product and create main function
Add passed_phases to Product and create main function
Python
mit
AliGhahraei/phar-ant-colony
b6dea08a0a9908d2303693cf4534c7b0beec4154
analyticpi/db.py
analyticpi/db.py
import os import peewee APP_DIR = os.path.dirname(__file__) try: import urlparse import psycopg2 urlparse.uses_netloc.append('postgres') url = urlparse.urlparse(os.environ["DATABASE_URL"]) database = peewee.PostgresqlDatabase(database=url.path[1:], user=ur...
import os import peewee APP_DIR = os.path.dirname(__file__) try: import urlparse import psycopg2 urlparse.uses_netloc.append('postgres') url = urlparse.urlparse(os.environ["DATABASE_URL"]) database = peewee.PostgresqlDatabase(database=url.path[1:], user=ur...
Change from MySQL to SQLite3
Change from MySQL to SQLite3
Python
mit
analyticpi/analyticpi,analyticpi/analyticpi,analyticpi/analyticpi
6a1c699f92f43cbe65bf729352695473474a91ae
astm/__init__.py
astm/__init__.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from .version import __version__, __version_info__ from .exceptions import BaseASTMError, NotAccepted, ...
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from .version import __version__, __version_info__ from .exceptions import BaseASTMError, NotAccepted, ...
Fix compatibility issue with Python 2.6
Fix compatibility issue with Python 2.6
Python
bsd-3-clause
asingla87/python-astm,kxepal/python-astm,123412345/python-astm,andrexmd/python-astm,MarcosHaenisch/python-astm,eddiep1101/python-astm,briankip/python-astm,pombreda/python-astm,Iskander1b/python-astm,tinoshot/python-astm,mhaulo/python-astm,LogicalKnight/python-astm,AlanZatarain/python-astm,kxepal/python-astm,tectronics/...
aa143e28b61118c0fc3e5d28f2330572213b501c
halaqat/urls.py
halaqat/urls.py
"""halaqat URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
"""halaqat URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
Add students app url configuration
Add students app url configuration
Python
mit
EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat
b5fb888c5b74cc99008cdc7e226f354d20b71b8c
select_exact.py
select_exact.py
import sublime_plugin class SelectExactMatchCommand(sublime_plugin.TextCommand): last_selection = None def run(self, edit): selections = self.view.sel() if selections[0].empty(): selections.add(self.view.word(selections[0])) return word = self.view.substr(self....
import sublime_plugin class SelectExactMatchCommand(sublime_plugin.TextCommand): last_selection = None def run(self, edit): selections = self.view.sel() words_selection = False for selection in selections: if selection.empty(): words_selection = True ...
Fix the issue when use with multiple cursors and scroll the view when selected
Fix the issue when use with multiple cursors and scroll the view when selected
Python
mit
spywhere/SelectExact,spywhere/SelectExact
8e45eb77394ad47579f5726e8f2e63794b8e10c5
farnsworth/wsgi.py
farnsworth/wsgi.py
""" WSGI config for farnsworth project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION...
""" WSGI config for farnsworth project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION...
Fix python-path when WSGIPythonPath is not defined
Fix python-path when WSGIPythonPath is not defined
Python
bsd-2-clause
knagra/farnsworth,knagra/farnsworth,knagra/farnsworth,knagra/farnsworth
b33222fd9d16efa88864d0c1f28cce9d0a8c3f68
fastentrypoints.py
fastentrypoints.py
''' Monkey patch setuptools to write faster console_scripts with this format: from mymodule import entry_function entry_function() This is better. ''' from setuptools.command import easy_install @classmethod def get_args(cls, dist, header=None): """ Yield write_script() argument tuples for a distrib...
''' Monkey patch setuptools to write faster console_scripts with this format: from mymodule import entry_function entry_function() This is better. ''' from setuptools.command import easy_install @classmethod def get_args(cls, dist, header=None): """ Yield write_script() argument tuples for a distrib...
Make sure that .py file is used, even if .pyc got executed
Make sure that .py file is used, even if .pyc got executed If python already byte-compiled the source code to .pyc file, the __file__ points to .pyc, rather than to .py, which breaks the copying mechanism. Use regex substitution to make sure we're always copying the original source file.
Python
bsd-2-clause
ninjaaron/fast-entry_points
a116c3eae892a73b11372225a9bdf0194db75598
glanerbeard/web.py
glanerbeard/web.py
import logging from flask import ( Flask, render_template, abort ) from glanerbeard.server import Server app = Flask(__name__) app.config.from_object('glanerbeard.default_settings') app.config.from_envvar('GLANERBEARD_SETTINGS') numeric_level = getattr(logging, app.config['LOGLEVEL'].upper(), None) if not isinst...
import logging from flask import ( Flask, render_template, abort ) from glanerbeard.server import Server app = Flask(__name__) app.config.from_object('glanerbeard.default_settings') app.config.from_envvar('GLANERBEARD_SETTINGS') numeric_level = getattr(logging, app.config['LOGLEVEL'].upper(), None) if not isinst...
Use a template to render json.
Use a template to render json.
Python
apache-2.0
daenney/glanerbeard
ad0859f2e7b6f659fe964f786277ea2ad3fdf787
src/listener.py
src/listener.py
# -*- coding: utf-8 -*- import logging import socket import threading from connection import Connection import shared class Listener(threading.Thread): def __init__(self, host, port, family=socket.AF_INET): super().__init__(name='Listener') self.host = host self.port = port self.f...
# -*- coding: utf-8 -*- import logging import socket import threading from connection import Connection import shared class Listener(threading.Thread): def __init__(self, host, port, family=socket.AF_INET): super().__init__(name='Listener') self.host = host self.port = port self.f...
Add SO_REUSEADDR to socket options
Add SO_REUSEADDR to socket options
Python
mit
TheKysek/MiNode,TheKysek/MiNode
03b07ca359c218b10837c2f1cdf4027474fdd856
windberg_register/admin.py
windberg_register/admin.py
from windberg_register import models from django.contrib import admin class StarterAdmin(admin.ModelAdmin): list_display = ("name", "given", "age_group_short", "club_name", "email", "run_list", "comment") list_per_page = 1000 def club_name(self, obj): return obj.club.name club_name.short_desc...
import codecs from collections import defaultdict from django.http import HttpResponse import unicodecsv from windberg_register import models from django.contrib import admin class StarterAdmin(admin.ModelAdmin): list_display = ("name", "given", "age_group_short", "club_name", "email", "run_list", "comment") ...
Add csv export feature for appointments
Add csv export feature for appointments
Python
bsd-3-clause
janLo/Windberg-web,janLo/Windberg-web
6f770e3da8dda9bc91300e323d386f6a6863c86e
testing/test-cases/selenium-tests/pointClustering/testPointCluster.py
testing/test-cases/selenium-tests/pointClustering/testPointCluster.py
#!/usr/bin/env python from selenium_test import FirefoxTest, ChromeTest,\ setUpModule, tearDownModule class glPointsBase(object): testCase = ('pointClustering',) testRevision = 4 def loadPage(self): self.resizeWindow(640, 480) self.loadURL('pointClustering/index.html') self.w...
#!/usr/bin/env python from time import sleep from selenium_test import FirefoxTest, ChromeTest,\ setUpModule, tearDownModule class glPointsBase(object): testCase = ('pointClustering',) testRevision = 4 def loadPage(self): self.resizeWindow(640, 480) self.loadURL('pointClustering/inde...
Add an explicit sleep in pointClustering test
Add an explicit sleep in pointClustering test
Python
apache-2.0
OpenGeoscience/geojs,OpenGeoscience/geojs,Kitware/geojs,OpenGeoscience/geojs,Kitware/geojs,Kitware/geojs
7fbc356ec6896e441f2423bd3168ff231b4a8bb2
roles/openshift_hosted/filter_plugins/filters.py
roles/openshift_hosted/filter_plugins/filters.py
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Custom filters for use in openshift_hosted ''' class FilterModule(object): ''' Custom ansible filters for use by openshift_hosted role''' @staticmethod def get_router_replicas(replicas=None, router_nodes=None): ''' This function will return the number...
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Custom filters for use in openshift_hosted ''' class FilterModule(object): ''' Custom ansible filters for use by openshift_hosted role''' @staticmethod def get_router_replicas(replicas=None, router_nodes=None): ''' This function will return the number...
Fix get_router_replicas infrastructure node count.
Fix get_router_replicas infrastructure node count.
Python
apache-2.0
detiber/openshift-ansible,openshift/openshift-ansible,miminar/openshift-ansible,ttindell2/openshift-ansible,aveshagarwal/openshift-ansible,gburges/openshift-ansible,tagliateller/openshift-ansible,abutcher/openshift-ansible,mmahut/openshift-ansible,zhiwliu/openshift-ansible,zhiwliu/openshift-ansible,EricMountain-1A/open...
4733055d8eee5e0e3ca3bd47eaa5c776bb62c9a8
tests/test_geodataframe.py
tests/test_geodataframe.py
import unittest import json from geopandas import GeoDataFrame class TestSeries(unittest.TestCase): def setUp(self): # Data from http://www.nyc.gov/html/dcp/download/bytes/nybb_13a.zip # saved as geopandas/examples/nybb_13a.zip. self.df = GeoDataFrame.from_file( '/nybb_13a/nyb...
import unittest import json import numpy as np from geopandas import GeoDataFrame class TestDataFrame(unittest.TestCase): def setUp(self): # Data from http://www.nyc.gov/html/dcp/download/bytes/nybb_13a.zip # saved as geopandas/examples/nybb_13a.zip. self.df = GeoDataFrame.from_file( ...
Add test for values of text columns in GeoDataFrame from file
Add test for values of text columns in GeoDataFrame from file
Python
bsd-3-clause
maxalbert/geopandas,fonnesbeck/geopandas,geopandas/geopandas,geopandas/geopandas,scw/geopandas,micahcochran/geopandas,jdmcbr/geopandas,koldunovn/geopandas,jwass/geopandas,snario/geopandas,IamJeffG/geopandas,ozak/geopandas,perrygeo/geopandas,jdmcbr/geopandas,ozak/geopandas,urschrei/geopandas,geopandas/geopandas,jorisvan...
a581d057366d8b4ae94754e18ef02e4ec59e3c05
gensysinfo.py
gensysinfo.py
#!/usr/bin/env python import psutil import os import time def create_bar(filled): low = '.' high = '|' if filled > 1: low = str(int(filled)) high = str(int(filled + 1)) filled = filled - int(filled) filled = int(filled * 10) if filled < 5: color = "green" elif fi...
#!/usr/bin/env python import psutil import os import time def create_bar(filled): low = '.' high = '|' if filled > 1: low = str(int(filled)) high = str(int(filled + 1)) filled = filled - int(filled) filled = int(filled * 10) if filled < 5: color = "green" elif fi...
Use cpu_percent instead of getloadavg
Use cpu_percent instead of getloadavg This is functionally similar and available in older versions of psutil
Python
mit
wilfriedvanasten/miscvar,wilfriedvanasten/miscvar,wilfriedvanasten/miscvar
97d1dd6b14cff5196ccd2e2efad8a0aba5bf240b
tests/test_money.py
tests/test_money.py
from decimal import Decimal from django.test import TestCase from shop.money.money_maker import AbstractMoney, MoneyMaker class AbstractMoneyTest(TestCase): def test_is_abstract(self): self.assertRaises(TypeError, lambda: AbstractMoney(1)) class MoneyMakerTest(TestCase): def test_create_new_mone...
# -*- coding: utf-8 from __future__ import unicode_literals from decimal import Decimal from django.test import TestCase from shop.money.money_maker import AbstractMoney, MoneyMaker class AbstractMoneyTest(TestCase): def test_is_abstract(self): self.assertRaises(TypeError, lambda: AbstractMoney(1)) ...
Add a test for AbstractMoney.__unicode__
Add a test for AbstractMoney.__unicode__
Python
bsd-3-clause
nimbis/django-shop,jrief/django-shop,awesto/django-shop,rfleschenberg/django-shop,jrief/django-shop,nimbis/django-shop,jrief/django-shop,awesto/django-shop,khchine5/django-shop,rfleschenberg/django-shop,jrief/django-shop,divio/django-shop,divio/django-shop,rfleschenberg/django-shop,nimbis/django-shop,khchine5/django-sh...
913d06c323f188d7647d342257ab2c0eb153d879
tests/test_scale.py
tests/test_scale.py
from hypothesis import assume, given, strategies as st from pytest import raises # type: ignore from ppb_vector import Vector from utils import angle_isclose, isclose, lengths, vectors @given(v=vectors(), length=st.floats(max_value=0)) def test_scale_negative_length(v: Vector, length: float): """Test that Vecto...
from hypothesis import assume, given, strategies as st from pytest import raises # type: ignore from ppb_vector import Vector from utils import angle_isclose, isclose, lengths, vectors @given(v=vectors(), length=st.floats(max_value=0)) def test_scale_negative_length(v: Vector, length: float): """Test that Vecto...
Simplify length & alignment tests
tests/scale: Simplify length & alignment tests
Python
artistic-2.0
ppb/ppb-vector,ppb/ppb-vector
b19568c85458ac04b902dc03010e2d50177477e1
tests/test_utils.py
tests/test_utils.py
#!/usr/bin/python2.5 # # Copyright 2008 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 2008 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...
Add a start and end method to MockRequest
Add a start and end method to MockRequest
Python
apache-2.0
MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging
2ed0f0e9f875722d2ae21d595701d37646b74885
tingbot/__init__.py
tingbot/__init__.py
from . import platform_specific, input from .graphics import screen, Surface, Image from .run_loop import main_run_loop, every from .input import touch from .button import press from .web import webhook platform_specific.fixup_env() def run(loop=None): if loop is not None: every(seconds=1.0/30)(loop) ...
try: import pygame except ImportError: print 'Failed to import pygame' print '-----------------------' print '' print 'tingbot-python requires pygame. Please download and install pygame 1.9.1' print 'or later from http://www.pygame.org/download.shtml' print '' print "If you're using a vi...
Add import-time check for pygame (since we can't install automatically)
Add import-time check for pygame (since we can't install automatically)
Python
bsd-2-clause
furbrain/tingbot-python
91c6c7b8e8077a185e8a62af0c3bcb74d4026e7c
tests/search.py
tests/search.py
import pycomicvine import unittest api_key = "476302e62d7e8f8f140182e36aebff2fe935514b" class TestSearch(unittest.TestCase): def test_search_resource_type(self): search = pycomicvine.Search( resources="volume", query="Angel" ) self.assertIsInstance(sear...
import pycomicvine import unittest api_key = "476302e62d7e8f8f140182e36aebff2fe935514b" class TestSearch(unittest.TestCase): def test_search_resource_type(self): search = pycomicvine.Search( resources="volume", query="Angel" ) for v in search: ...
Check every result in Search test
Check every result in Search test
Python
mit
authmillenon/pycomicvine
709d6c530296fe9e0b03ad5ed28facd7c69b93fa
importjson.py
importjson.py
import json import pprint import os with open('json/test.json') as json_data: d = json.load(json_data) # print(d) # pprint.pprint(d) for stat_categories in d["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]: pprint.pprint(stat_categories)
import json import pprint import os #Open the JSON file that includes headers with open('json/20160927-division-team-standings.json') as file: alltext = file.readlines() #Put each line into a list for lines in alltext: if lines.startswith('{'): rawdata = lines data = json.loads(rawdata) ...
Create JSON importer from raw JSON file including web headers and pretty print all of the stat categories for one file
Create JSON importer from raw JSON file including web headers and pretty print all of the stat categories for one file
Python
mit
prcutler/nflpool,prcutler/nflpool
7faa73b5046fb87099d955705c4f00c5240f3544
running.py
running.py
import tcxparser from darksky import forecast from configparser import ConfigParser # Darksky weather API. # Create config file manually parser = ConfigParser() parser.read('slowburn.config', encoding='utf-8') darksky_key = parser.get('darksky', 'key') tcx = tcxparser.TCXParser('gps_logs/2017-06-15_Running.tcx') pri...
import tcxparser from configparser import ConfigParser from datetime import datetime import urllib.request import dateutil.parser t = '1984-06-02T19:05:00.000Z' # Darksky weather API # Create config file manually parser = ConfigParser() parser.read('slowburn.config', encoding='utf-8') darksky_key = parser.get('darksky...
Call Darksky API with TCX run time Use simpler GET request to Darksky API rather than a third party Python wrapper
Call Darksky API with TCX run time Use simpler GET request to Darksky API rather than a third party Python wrapper
Python
mit
briansuhr/slowburn
19fb86f8b3a2307489f926d9d5d78bd84c6b05a1
Sketches/MH/TimerMixIn.py
Sketches/MH/TimerMixIn.py
#!/usr/bin/env python from Axon.Component import component from threading import Timer class TimerMixIn(object): def __init__(self, *argl, **argd): super(TimerMixIn,self).__init__(*argl,**argd) self.timer = None self.timerSuccess = True def startTimer(self, secs): ...
#!/usr/bin/env python from Axon.Component import component from threading import Timer class TimerMixIn(object): def __init__(self, *argl, **argd): super(TimerMixIn,self).__init__(*argl,**argd) self.timer = None self.timerSuccess = True def startTimer(self, secs): ...
Handle situation if timer is already running.
Handle situation if timer is already running.
Python
apache-2.0
sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia
2df886059a9edd8d75fdb255fc185c2f96a02c29
user/signals.py
user/signals.py
import re from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from user import tokens from user.models import User REGEX_PATTERN = getattr(settings, 'REGEX_HACKATHON_ORGANIZER_EMAIL', None) # MAke user organizer if fits regex @receiver(post_save, sen...
import re from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from user import tokens from user.models import User REGEX_PATTERN = getattr(settings, 'REGEX_HACKATHON_ORGANIZER_EMAIL', None) DEV_EMAILS = getattr(settings, 'HACKATHON_DEV_EMAILS', None) ...
Make developers an admin on registration
Make developers an admin on registration
Python
mit
hackupc/backend,hackupc/backend,hackupc/backend,hackupc/backend
87b3d17bcee42630ec502475e67d5f58cee4f577
cafe/utilities.py
cafe/utilities.py
from six import string_types def listify(arg): """ Simple utility method to ensure an argument provided is a list. If the provider argument is not an instance of `list`, then we return [arg], else arg is returned. :type arg: list :rtype: list """ if not isinstance(arg, list): retu...
from os import getenv from six import string_types def listify(arg): """ Simple utility method to ensure an argument provided is a list. If the provider argument is not an instance of `list`, then we return [arg], else arg is returned. :type arg: list :rtype: list """ if not isinstance(ar...
Add function to resolve settings from multiple sources
Add function to resolve settings from multiple sources utilities.resolve_setting() takes values for a setting from multiple sources and picks the appropriate value in order of source priority.
Python
apache-2.0
abn/python-cafe
c11152dc83416efb33bd4c8286633a311430c0f6
mpsort/__init__.py
mpsort/__init__.py
from .binding import sort as _sort import numpy from numpy.lib.recfunctions import append_fields try: unicode = unicode except NameError: # 'unicode' is undefined, must be Python 3 str = str unicode = str bytes = bytes basestring = (str,bytes) else: # 'unicode' exists, must be Python 2 ...
from .binding import sort as _sort import numpy from numpy.lib.recfunctions import append_fields try: unicode = unicode except NameError: # 'unicode' is undefined, must be Python 3 str = str unicode = str bytes = bytes basestring = (str,bytes) else: # 'unicode' exists, must be Python 2 ...
Fix out place mismatched out array size.
Fix out place mismatched out array size.
Python
bsd-2-clause
rainwoodman/MP-sort,rainwoodman/MP-sort,rainwoodman/MP-sort
95186f684328d5b84611f405d47d474c53cad619
cat.py
cat.py
import io import aiohttp from discord.ext import commands import yaml class Cat: def __init__(self, bot): self.bot = bot with open('config.yaml') as file: data = yaml.load(file) self.key = data.get('cat_key', '') self.url = 'http://thecatapi.com/api/images...
import io import aiohttp import discord from discord.ext import commands from lxml import etree import yaml class Cat: def __init__(self, bot): self.bot = bot with open('config.yaml') as file: data = yaml.load(file) self.key = data.get('cat_key', '') sel...
Send image in embed because aiohttp doesn't know how to parse links
Send image in embed because aiohttp doesn't know how to parse links
Python
mit
BeatButton/beattie,BeatButton/beattie-bot
2ec1975da12cb9d95b1e1db7820f30850e075e4e
running.py
running.py
import tcxparser tcx = tcxparser.TCXParser('gps_logs/2017-06-15_Running.tcx') print(tcx.duration)
import tcxparser from darksky import forecast from configparser import ConfigParser # Darksky weather API. # Create config file manually parser = ConfigParser() parser.read('slowburn.config', encoding='utf-8') darksky_key = parser.get('darksky', 'key') tcx = tcxparser.TCXParser('gps_logs/2017-06-15_Running.tcx') pri...
Add sample Darksky API call
Add sample Darksky API call
Python
mit
briansuhr/slowburn
4d1444e2f2a455e691342a82f0e116e210593411
s01/c01.py
s01/c01.py
"""Set 01 - Challenge 01.""" import base64 hex_string = ('49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f' '69736f6e6f7573206d757368726f6f6d') b64_string = b'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t' def hex2b64(hex_string): """Convert a hex string into a bas...
"""Set 01 - Challenge 01.""" import binascii hex_string = ('49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f' '69736f6e6f7573206d757368726f6f6d') b64_string = 'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t' def hex2b64(hex_string): """Convert a hex string into a b...
Revert "Updated function to work on bytes rather than binascii functions."
Revert "Updated function to work on bytes rather than binascii functions." This reverts commit 25176b64aed599059e4b552fbd76c5f4bc28434e.
Python
mit
sornars/matasano-challenges-py
3d414a7bc4b5e6c6c2b1ec8f44b69bab537fd50d
wsgi_general.py
wsgi_general.py
import DQXUtils def application(environ, start_response): #For the root we do a relative redirect to index.html, hoping the app has one if environ['PATH_INFO'] == '/': start_response('301 Moved Permanently', [('Location', 'index.html'),]) return DQXUtils.LogServer('404:' + environ['PATH_I...
import DQXUtils import DQXDbTools def application(environ, start_response): #For the root we do a relative redirect to index.html, hoping the app has one if environ['PATH_INFO'] == '/': start_response('301 Moved Permanently', [('Location', 'index.html'),]) return with DQXDbTools.DBCursor()...
Allow URLS to have dataset names in
Allow URLS to have dataset names in
Python
agpl-3.0
cggh/DQXServer
acdcb3d01dea2af0dc94c22ee5f40304da8d462a
src/pycrunchbase/resource/investment.py
src/pycrunchbase/resource/investment.py
import six from .node import Node @six.python_2_unicode_compatible class Investment(Node): """Represents a Investment (investor-investment) on CrunchBase""" KNOWN_PROPERTIES = [ 'type', 'uuid', 'money_invested', 'money_invested_currency_code', 'money_invested_usd', ...
import six from .node import Node @six.python_2_unicode_compatible class Investment(Node): """Represents a Investment (investor-investment) on CrunchBase""" KNOWN_PROPERTIES = [ 'type', 'uuid', 'money_invested', 'money_invested_currency_code', 'money_invested_usd', ...
Add new relationship to Investment resource
Add new relationship to Investment resource
Python
mit
ngzhian/pycrunchbase,SidSachdev/pycrunchbase,alabid/pycrunchbase
1072e6225a49f409b2b20b000ccdc6f70f0c45e8
spotify.py
spotify.py
import sys import random from pytz import timezone from datetime import datetime import pytz from libs import post_text import spotipy import os from spotipy.oauth2 import SpotifyClientCredentials ''' sadness_texts = [line.strip() for line in open('list of saddness.txt')] central = timezone('US/Central') now = datetim...
import sys import random from pytz import timezone from datetime import datetime import pytz from libs import post_text import spotipy import os from spotipy.oauth2 import SpotifyClientCredentials ''' sadness_texts = [line.strip() for line in open('list of saddness.txt')] central = timezone('US/Central') now = datetim...
Debug song of the week
Debug song of the week
Python
mit
Boijangle/GroupMe-Message-Bot
498552599753f07d179025b5de1e8207ec2b94cd
test/unit/util/test_multipart_stream.py
test/unit/util/test_multipart_stream.py
# coding: utf-8 from __future__ import unicode_literals, absolute_import import pytest from boxsdk.util.multipart_stream import MultipartStream @pytest.fixture(params=({}, {'data_1': b'data_1_value', 'data_2': b'data_2_value'})) def multipart_stream_data(request): return request.param @pytest.fixture(params=...
# coding: utf-8 from __future__ import unicode_literals, absolute_import import pytest from boxsdk.util.multipart_stream import MultipartStream @pytest.fixture(params=({}, {'data_1': b'data_1_value', 'data_2': b'data_2_value'})) def multipart_stream_data(request): return request.param @pytest.fixture(params=...
Disable redefined outer name pylint warning.
Disable redefined outer name pylint warning.
Python
apache-2.0
Frencil/box-python-sdk,Frencil/box-python-sdk,box/box-python-sdk
79996420e775994b53d88f5b7c9ad21106a77831
examples/tests/test_examples.py
examples/tests/test_examples.py
import pytest from examples.gbest_pso import main as gbest from examples.lbest_pso import main as lbest from examples.gc_pso import main as gc from examples.pso_optimizer import main as pso_optimizer @pytest.mark.parametrize("dimension", [ 1, 30 ]) @pytest.mark.parametrize("iterations", [ 3 ]) def test_g...
# Copyright 2016 Andrich van Wyk # # 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, ...
Add license header and file documentation
Add license header and file documentation
Python
apache-2.0
avanwyk/cipy
8e61726b178c5175347008b9b77032fd223b6114
elections_r_us/security.py
elections_r_us/security.py
from models import User from passlib.apps import custom_app_context as pwd_context def create_user(session, username, password): """Add a new user to the database. session is expected to be a dbsession, username and password are expected to be (unencrypted) unicode strings.""" session.add(User( ...
from .models import User from passlib.apps import custom_app_context as pwd_context def create_user(session, username, password): """Add a new user to the database. session is expected to be a dbsession, username and password are expected to be (unencrypted) unicode strings.""" session.add(User( ...
Move query assignment out of try block
Move query assignment out of try block make import relative
Python
mit
Elections-R-Us/Elections-R-Us,Elections-R-Us/Elections-R-Us,Elections-R-Us/Elections-R-Us,Elections-R-Us/Elections-R-Us
7bde0ba157431311ae138acd8a2018f85d8af91d
test_data.py
test_data.py
def f1(a, # S100 b): # S101 pass def f2( a, b # S101 ): pass def f3( a, b, ): pass # trailing comma after *args or **kwargs is a syntax error therefore # we don't want to enforce it such situations def f4( a, *args ): pass def f5( b, **kwargs ): pa...
def f1(a, # S100 b): # S101 pass def f2( a, b # S101 ): pass def f3( a, b, ): pass # trailing comma after *args or **kwargs is a syntax error therefore # we don't want to enforce it such situations def f4( a, *args ): pass def f5( b, **kwargs ): pa...
Add a test for functions with keyword only arguments
Add a test for functions with keyword only arguments This adds a test to ensure that no error is raised if a trailing comma is missing from a function definition that has keyword only arguments. Reviewed-by: Jakub Stasiak <1d3764b91b902f6b45836e2498da81fe35caf6d6@stasiak.at>
Python
mit
smarkets/flake8-strict
176c98dd7fec26980591a9ba3bb71bee1eeab8a7
backend/fureon/components/mixins.py
backend/fureon/components/mixins.py
import threading class SingletonMixin(object): __singleton_lock = threading.Lock() __singleton_instance = None @classmethod def instance(cls, *args, **kwargs): if not cls.__singleton_instance: with cls.__singleton_lock: if not cls.__singleton_instance: ...
import threading class SingletonMixin(object): __singleton_lock = None __singleton_instance = None @classmethod def instance(cls, *args, **kwargs): if not cls.__singleton_lock: cls.__singleton_lock = threading.Lock() if not cls.__singleton_instance: with cls._...
Change singletons to instantiate locks per-class
Change singletons to instantiate locks per-class Before it was creating one for any singleton object, resulting in Bad Things (infinite lock) happening when one singleton object instantiates another singleton object in its instantiation. (I hope that made sense...)
Python
apache-2.0
ATRAN2/fureon
77f820fe1286a5d39f2704c3821251bcbe20a2ba
indra/tests/test_rlimsp.py
indra/tests/test_rlimsp.py
from indra.sources import rlimsp def test_simple_usage(): rp = rlimsp.process_pmc('PMC3717945') stmts = rp.statements assert len(stmts) == 6, len(stmts) def test_ungrounded_usage(): rp = rlimsp.process_pmc('PMC3717945', with_grounding=False) assert len(rp.statements) == 33, len(rp.statements)
from indra.sources import rlimsp def test_simple_usage(): rp = rlimsp.process_pmc('PMC3717945') stmts = rp.statements assert len(stmts) == 6, len(stmts) for s in stmts: assert len(s.evidence) == 1, "Wrong amount of evidence." ev = s.evidence[0] assert ev.annotations, "Missing a...
Make basic test more particular.
Make basic test more particular.
Python
bsd-2-clause
sorgerlab/indra,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,bgyori/indra,johnbachman/belpy,sorgerlab/indra,bgyori/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,johnbachman/indra
f6cd6b3377769af524377979438b9e662bb9175a
tangled/site/model/base.py
tangled/site/model/base.py
import datetime from sqlalchemy.schema import Column from sqlalchemy.types import DateTime, Integer from sqlalchemy.ext.declarative import declarative_base, declared_attr Base = declarative_base() class BaseMixin: id = Column(Integer, primary_key=True) @declared_attr def __tablename__(cls): ...
from datetime import datetime from sqlalchemy.schema import Column from sqlalchemy.types import DateTime, Integer from sqlalchemy.ext.declarative import declarative_base, declared_attr Base = declarative_base() class BaseMixin: id = Column(Integer, primary_key=True) @declared_attr def __tablename__(...
Update updated time on update
Update updated time on update I.e., added onupdate=datetime.now to TimestampMixin.updated_at so that it will be automatically updated whenever a record is edited.
Python
mit
TangledWeb/tangled.site
4518263958a9985a7b9b2018264ee0c42479fd10
src/tempel/urls.py
src/tempel/urls.py
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^\+media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), (r'^admin/', include(admin.site.urls)), (r'^(...
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^\+media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), (r'^admin/', include(admin.site.urls)), url(r...
Add names to each url
Add names to each url
Python
agpl-3.0
fajran/tempel
dc2ed8e733d0497e1812ee31b61279083ef1861f
backend/breach/tests/base.py
backend/breach/tests/base.py
from django.test import TestCase from breach.models import SampleSet, Victim, Target, Round class RuptureTestCase(TestCase): def setUp(self): target = Target.objects.create( endpoint='https://di.uoa.gr/?breach=%s', prefix='test', alphabet='0123456789' ) ...
from django.test import TestCase from breach.models import SampleSet, Victim, Target, Round class RuptureTestCase(TestCase): def setUp(self): target = Target.objects.create( endpoint='https://di.uoa.gr/?breach=%s', prefix='test', alphabet='0123456789' ) ...
Add balance checking test samplesets
Add balance checking test samplesets
Python
mit
dimriou/rupture,dimkarakostas/rupture,dionyziz/rupture,esarafianou/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,esarafianou/rupture,dionyziz/rupture,dionyziz/rupture,esarafianou/rupture,dimkarakostas/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,d...
e6ee77f88ab0d05b221b5470d2c649d3d242f505
hecate/core/__init__.py
hecate/core/__init__.py
from hecate.core.base import CellularAutomaton from hecate.core.properties import ( IntegerProperty, ) from hecate.core.topology.lattice import ( OrthogonalLattice, ) from hecate.core.topology.neighborhood import ( MooreNeighborhood, ) from hecate.core.topology.border import ( TorusBorder, ) from hecate...
from hecate.core.base import CellularAutomaton from hecate.core.properties import ( IntegerProperty, ) from hecate.core.topology.lattice import ( OrthogonalLattice, ) from hecate.core.topology.neighborhood import ( MooreNeighborhood, ) from hecate.core.topology.border import ( TorusBorder, StaticBorder,...
Add StaticBorder to public API
Add StaticBorder to public API
Python
mit
a5kin/hecate,a5kin/hecate
f5d3fb307bb17bc6651fe32ea2f520e7b87d37ca
utility.py
utility.py
#!/usr/bin/env python """ Copyright 2016 Brian Quach Licensed under MIT (https://github.com/brianquach/udacity-nano-fullstack-conference/blob/master/LICENSE) # noqa Code Citation: https://github.com/udacity/FSND-P4-Design-A-Game/blob/master/Skeleton%20Project%20Guess-a-Number/utils.py #noqa """ import endpoints f...
#!/usr/bin/env python """ Code Citation: https://github.com/udacity/FSND-P4-Design-A-Game/blob/master/Skeleton%20Project%20Guess-a-Number/utils.py #noqa """ import endpoints from google.appengine.ext import ndb def get_by_urlsafe(urlsafe, model): """Returns an ndb.Model entity that the urlsafe key points to. ...
Remove copyright to code not written by bquach.
Doc: Remove copyright to code not written by bquach.
Python
mit
brianquach/udacity-nano-fullstack-game
e16911bb965a86fc841b17d4748fdc75d8ed5cf2
quizzes.py
quizzes.py
from database import QuizDB db = QuizDB(host=config.REDIS_HOST, port=config.REDIS_PORT) class Quiz(Base): def __init__(self, id): self.id = id QUESTION_HASH = "{0}:question".format(self.id) ANSWER_HASH = "{0}:answer".format(self.id) def new_card(self, question, answer): assert db.hl...
from database import QuizDB db = QuizDB(host=config.REDIS_HOST, port=config.REDIS_PORT) class Quiz(Base): def __init__(self, id): self.id = id QUESTION_HASH = "{0}:question".format(self.id) ANSWER_HASH = "{0}:answer".format(self.id) def new_card(self, question, answer): assert db.hl...
Add additional CRUD functions to Quiz class
Add additional CRUD functions to Quiz class
Python
bsd-2-clause
estreeper/quizalicious,estreeper/quizalicious,estreeper/quizalicious
a769c30a874913cbf053c6973b137520dfc58e93
stingray/__init__.py
stingray/__init__.py
# Licensed under MIT license - see LICENSE.rst """ This is an Astropy affiliated package. """ # Affiliated packages may add whatever they like to this file, but # should keep this content at the top. # ---------------------------------------------------------------------------- from ._astropy_init import * # --------...
# Licensed under MIT license - see LICENSE.rst """ Library of Time Series Methods For Astronomical X-ray Data. """ # Affiliated packages may add whatever they like to this file, but # should keep this content at the top. # ---------------------------------------------------------------------------- from ._astropy_ini...
Remove useless information from library description
Remove useless information from library description
Python
mit
evandromr/stingray,abigailStev/stingray,dhuppenkothen/stingray,pabell/stingray,StingraySoftware/stingray
9b820aff6fc64ffa750dbf92a51d754f9c55ab79
froide/publicbody/search_indexes.py
froide/publicbody/search_indexes.py
from __future__ import print_function from django.conf import settings from haystack import indexes from celery_haystack.indexes import CelerySearchIndex from .models import PublicBody PUBLIC_BODY_BOOSTS = settings.FROIDE_CONFIG.get("public_body_boosts", {}) class PublicBodyIndex(CelerySearchIndex, indexes.Indexa...
from __future__ import print_function from django.conf import settings from haystack import indexes from celery_haystack.indexes import CelerySearchIndex from .models import PublicBody PUBLIC_BODY_BOOSTS = settings.FROIDE_CONFIG.get("public_body_boosts", {}) class PublicBodyIndex(CelerySearchIndex, indexes.Indexa...
Make topic_* field on public body search index optional
Make topic_* field on public body search index optional
Python
mit
okfse/froide,ryankanno/froide,fin/froide,catcosmo/froide,ryankanno/froide,stefanw/froide,okfse/froide,catcosmo/froide,okfse/froide,ryankanno/froide,stefanw/froide,ryankanno/froide,stefanw/froide,stefanw/froide,okfse/froide,okfse/froide,LilithWittmann/froide,catcosmo/froide,CodeforHawaii/froide,fin/froide,LilithWittmann...
d8a36da519dd5b5659777e2b92564569a3dfb9f8
test/test_get_new.py
test/test_get_new.py
from __future__ import absolute_import, print_function from ..pyautoupdate.launcher import Launcher from .pytest_skipif import needinternet from .pytest_makevers import fixture_update_dir import os import sys import pytest @pytest.mark.trylast @needinternet def test_check_get_new(fixture_update_dir): """Test th...
from __future__ import absolute_import, print_function from ..pyautoupdate.launcher import Launcher from .pytest_skipif import needinternet from .pytest_makevers import fixture_update_dir import os import sys import pytest @needinternet def test_check_get_new(fixture_update_dir): """Test that gets new version f...
Write test that attempts to unpack invalid archive
Write test that attempts to unpack invalid archive
Python
lgpl-2.1
rlee287/pyautoupdate,rlee287/pyautoupdate
75add42972c059a00b01fe2b4eeb716d905a3bd6
mamba/cli.py
mamba/cli.py
# -*- coding: utf-8 -*- import sys import imp from mamba import formatters from mamba.runner import Runner def main(): formatter = formatters.DocumentationFormatter() runner = Runner(formatter) for file_ in sys.argv[1:]: module = imp.load_source(file_.replace('.py', ''), file_) runner.r...
# -*- coding: utf-8 -*- import sys import os import imp from mamba import formatters from mamba.runner import Runner def main(): formatter = formatters.DocumentationFormatter() runner = Runner(formatter) for file_ in _specs(): module = imp.load_source(file_.replace('.py', ''), file_) ru...
Load specs from spec/**/*_spec.py if no spec was specified
Load specs from spec/**/*_spec.py if no spec was specified
Python
mit
angelsanz/mamba,eferro/mamba,alejandrodob/mamba,dex4er/mamba,nestorsalceda/mamba,markng/mamba,jaimegildesagredo/mamba
3d1c4c3bd3dd6ae48e75772a2f2706d6104d189c
googkit.py
googkit.py
import os import sys from commands.apply_config import ApplyConfigCommand from commands.compile import CompileCommand from commands.init import InitCommand from commands.setup import SetupCommand from commands.update_deps import UpdateDepsCommand from lib.config import Config from lib.error import GoogkitError CONFIG...
import os import sys from commands.apply_config import ApplyConfigCommand from commands.compile import CompileCommand from commands.init import InitCommand from commands.setup import SetupCommand from commands.update_deps import UpdateDepsCommand from lib.config import Config from lib.error import GoogkitError CONFIG...
Support making available to exec cmd on sub dir
Support making available to exec cmd on sub dir
Python
mit
googkit/googkit,googkit/googkit,googkit/googkit
f1a5c564d56996d023cc891f56c28000ba24df7f
src/client.py
src/client.py
#!/usr/bin/env python3 import socket import time import math import random HOST, PORT = 'localhost', 7777 LIMIT = 0.5 posx, posy, posz = 0.0, 0.0, 0.0 def change_pos(*values): range_delta = 0.1 output = [] for pos in values: pos_min = pos - range_delta pos_min = -0.5 if pos_min < -0.5 e...
#!/usr/bin/env python3 import socket import time import math import random HOST, PORT = 'localhost', 7777 LIMIT = 0.5 posx = random.uniform(-50.00, 50.00) posy = random.uniform(-50.00, 50.00) posz = random.uniform(-50.00, 50.00) def change_pos(*values): range_delta = 0.1 output = [] for pos in values: ...
Use better start values for arm
Use better start values for arm
Python
mit
saleone/bachelor-thesis
78b82b0c5e074c279288b9d53fe9cb5cfe1381ae
fabfile.py
fabfile.py
# -*- coding: utf-8 -*- from fabric.api import ( lcd, local, task) @task def clean(): local('rm -rf wheelhouse') local('rm -rf dist') local('rm -rf build') with lcd('doc'): local('make clean') @task def docs(): with lcd('doc'): local('make html')
# -*- coding: utf-8 -*- from fabric.api import ( lcd, local, task) @task def clean(): local('rm -rf wheelhouse') local('rm -rf dist') local('rm -rf build') local('rm -rf test/unit/__pycache__') local('rm -rf test/integration/__pycache__') with lcd('doc'): local('make clea...
Kill __pycache__ directories in tests
Kill __pycache__ directories in tests
Python
mit
smarter-travel-media/stac
b1890ccd9946054cde25bbd511e317ec0b844b9a
webserver/hermes/models.py
webserver/hermes/models.py
from django.db import models from django.db.models.signals import pre_save, post_save from django.dispatch import receiver from django.conf import settings from competition.models import Team import json class TeamStats(models.Model): team = models.OneToOneField(Team) data_field = models.TextField(null=True...
from django.db import models from django.db.models.signals import pre_save, post_save from django.dispatch import receiver from django.conf import settings from competition.models import Team import json class TeamStats(models.Model): team = models.OneToOneField(Team) data_field = models.TextField(null=True...
Add str method to TeamStats
Add str method to TeamStats
Python
bsd-3-clause
siggame/webserver,siggame/webserver,siggame/webserver
8cf555f2c8424cc8460228bac07940a19cf1a6a5
zinnia_akismet/__init__.py
zinnia_akismet/__init__.py
"""Spam checker backends for Zinnia based on Akismet"""
"""Spam checker backends for Zinnia based on Akismet""" __version__ = '1.0.dev' __license__ = 'BSD License' __author__ = 'Fantomas42' __email__ = 'fantomas42@gmail.com' __url__ = 'https://github.com/Fantomas42/zinnia-spam-checker-akismet'
Move package metadatas at the code level
Move package metadatas at the code level
Python
bsd-3-clause
django-blog-zinnia/zinnia-spam-checker-akismet
43b00bdb18131c49a6e52d752aeb0549298d8cda
avena/tests/test-image.py
avena/tests/test-image.py
#!/usr/bin/env python from numpy import all, array, dstack from .. import image def test_get_channels(): x = array([[1, 2, 3], [2, 3, 4], [3, 4, 5]]) y = dstack((x, x, x)) for z in image.get_channels(y): assert all(z == x) def test_map_to_channels(): def f(x): return x + 1 x = ...
#!/usr/bin/env python from numpy import all, allclose, array, dstack from os import remove from os.path import sep, split from .. import image, utils def test_get_channels(): x = array([[1, 2, 3], [2, 3, 4], [3, 4, 5]]) y = dstack((x, x, x)) for z in image.get_channels(y): assert all(z == x) d...
Add more unit tests for the image module.
Add more unit tests for the image module.
Python
isc
eliteraspberries/avena
9236ac7c0893cc1c4cf19755683d4ab38590de7d
spym-as.py
spym-as.py
#!/usr/bin/env python2.7 import argparse from util.assemble import assemble from util.hexdump import hexdump def get_args(): parser = argparse.ArgumentParser(description='Spym MIPS Assembler. Generates "spym" format binaries.') parser.add_argument('file', metavar='FILE', type=str, he...
#!/usr/bin/env python2.7 import argparse from util.assemble import assemble def get_args(): parser = argparse.ArgumentParser(description='Spym MIPS Assembler. Generates "spym" format binaries.') parser.add_argument('file', metavar='FILE', type=str, help='MIPS source file') parser...
Write to file instead of hexdump
Write to file instead of hexdump
Python
mit
mossberg/spym,mossberg/spym
de06a96af887b2bbfa6589b2881606c29000398e
cabot/cabotapp/jenkins.py
cabot/cabotapp/jenkins.py
from os import environ as env from django.conf import settings import requests from datetime import datetime from django.utils import timezone from celery.utils.log import get_task_logger logger = get_task_logger(__name__) auth = (settings.JENKINS_USER, settings.JENKINS_PASS) def get_job_status(jobname): ret =...
from os import environ as env from django.conf import settings import requests from datetime import datetime from django.utils import timezone from celery.utils.log import get_task_logger logger = get_task_logger(__name__) auth = (settings.JENKINS_USER, settings.JENKINS_PASS) def get_job_status(jobname): ret =...
Add check for "green" status for Hudson
Add check for "green" status for Hudson Hudson and Jenkins have extremely similar APIs, one of the main differences is that Jenkins uses "blue" but Hudson uses "green" for a successful last build. Adding the option to check for "green" status allows the Jenkins checks to also work for checking Hudson jobs. Jenkins...
Python
mit
arachnys/cabot,cmclaughlin/cabot,cmclaughlin/cabot,arachnys/cabot,maks-us/cabot,cmclaughlin/cabot,bonniejools/cabot,arachnys/cabot,bonniejools/cabot,bonniejools/cabot,bonniejools/cabot,maks-us/cabot,arachnys/cabot,maks-us/cabot,maks-us/cabot,cmclaughlin/cabot
29564aca770969c0ff75413f059e5db7d33a69a7
blog/utils.py
blog/utils.py
from django.shortcuts import get_object_or_404 from .models import Post class PostGetMixin: errors = { 'url_kwargs': "Generic view {} must be called with " "year, month, and slug.", } def get_object(self, queryset=None): year = self.kwargs.get('year') mon...
from django.shortcuts import get_object_or_404 from .models import Post class PostGetMixin: month_url_kwarg = 'month' year_url_kwarg = 'year' errors = { 'url_kwargs': "Generic view {} must be called with " "year, month, and slug.", } def get_object(self, queryset...
Add date URL kwarg options to PostGetMixin.
Ch18: Add date URL kwarg options to PostGetMixin.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8