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
06bfabc328c4aa32120fd7e52302db76974c2d1b
greengraph/command.py
greengraph/command.py
from argparse import ArgumentParser from matplotlib import pyplot as plt from graph import Greengraph def process(): parser = ArgumentParser( description="Produce graph quantifying the amount of green land between two locations") parser.add_argument("--start", nargs="+", help="...
from argparse import ArgumentParser from matplotlib import pyplot as plt from graph import Greengraph def process(): parser = ArgumentParser( description="Produce graph quantifying the amount of green land between two locations") parser.add_argument("--start", nargs="+", help="...
Correct error where && was used instead of and
Correct error where && was used instead of and
Python
mit
MikeVasmer/GreenGraphCoursework
0b82a5c10a9e728f6f5424429a70fd2951c9b5c5
pythonmisp/__init__.py
pythonmisp/__init__.py
from .misp import MispTag, MispEvent, MispServer, MispAttribute, MispShadowAttribute
from .misp import MispTag, MispEvent, MispServer, MispAttribute, MispShadowAttribute, MispTransportError
Add MispTransportError in package import
Add MispTransportError in package import
Python
apache-2.0
nbareil/python-misp
b7d928b473ec6b1eb60707783842d78b9a9ecdec
info.py
info.py
#!/usr/bin/env python # Print information columns of number values. import sys import numpy as np from dwi import asciifile for filename in sys.argv[1:]: af = asciifile.AsciiFile(filename) print filename print af.d['description'] params = af.params() for i, a in enumerate(af.a.T): d = di...
#!/usr/bin/env python # Print information columns of number values. import sys import numpy as np from dwi import asciifile for filename in sys.argv[1:]: af = asciifile.AsciiFile(filename) print filename if af.d.has_key('description'): print af.d['description'] params = af.params() for i...
Print sum. Print description only if it exists.
Print sum. Print description only if it exists.
Python
mit
jupito/dwilib,jupito/dwilib
b773186f4e39e531e162e3d56a129a21129864e7
bookmarks/views.py
bookmarks/views.py
from rest_framework import serializers from rest_framework_json_api.views import ModelViewSet from .models import Collection, Item class ItemSerializer(serializers.ModelSerializer): class Meta: model = Item fields = ["id", "key", "value", "kind", "row", "collection"] class ItemViewSet(ModelView...
from rest_framework import serializers from rest_framework_json_api.views import ModelViewSet from .models import Collection, Item class ItemSerializer(serializers.ModelSerializer): class Meta: model = Item fields = ["id", "key", "value", "kind", "row", "collection"] class ItemViewSet(ModelView...
Add item_set to collections response
Add item_set to collections response
Python
mit
GSC-RNSIT/bookmark-manager,GSC-RNSIT/bookmark-manager,rohithpr/bookmark-manager,rohithpr/bookmark-manager
fc609dd987593d58cddec3af8865a1d3a456fb43
modules/expansion/dns.py
modules/expansion/dns.py
import json import dns.resolver mispattributes = {'input':['hostname', 'domain'], 'output':['ip-src', 'ip-dst']} def handler(q=False): if q is False: return False request = json.loads(q) if request.get('hostname'): toquery = request['hostname'] elif request.get('domain'): toque...
import json import dns.resolver mispattributes = {'input':['hostname', 'domain'], 'output':['ip-src', 'ip-dst']} moduleinfo = "0.1" def handler(q=False): if q is False: return False request = json.loads(q) if request.get('hostname'): toquery = request['hostname'] elif request.get('doma...
Add a version per default
Add a version per default
Python
agpl-3.0
amuehlem/misp-modules,amuehlem/misp-modules,Rafiot/misp-modules,VirusTotal/misp-modules,amuehlem/misp-modules,MISP/misp-modules,VirusTotal/misp-modules,Rafiot/misp-modules,Rafiot/misp-modules,VirusTotal/misp-modules,MISP/misp-modules,MISP/misp-modules
c1fbc761e10e06effa49ede1f8dbc04189999bd5
niftynet/layer/post_processing.py
niftynet/layer/post_processing.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function import tensorflow as tf from niftynet.utilities.util_common import look_up_operations from niftynet.layer.base_layer import Layer SUPPORTED_OPS = {"SOFTMAX", "ARGMAX", "IDENTITY"} class PostProcessingLayer(Layer): """ This layer...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function import tensorflow as tf from niftynet.utilities.util_common import look_up_operations from niftynet.layer.base_layer import Layer SUPPORTED_OPS = {"SOFTMAX", "ARGMAX", "IDENTITY"} class PostProcessingLayer(Layer): """ This layer...
Change label output to int32 for compatibility with some viewers
Change label output to int32 for compatibility with some viewers
Python
apache-2.0
NifTK/NiftyNet,NifTK/NiftyNet,NifTK/NiftyNet,NifTK/NiftyNet
07bc7efb756e2bc99f59c59476379bc186f36143
sktracker/io/__init__.py
sktracker/io/__init__.py
"""`sktracker.io` module is designed to easly and quickly open Tiff files and to be able to parse and import any kind of metadata. Finally, an OME module is provided to read and write OME xml metadata. See https://www.openmicroscopy.org/site/support/ome-model/ for details. """ from .tifffile import imsave from .tiff...
"""`sktracker.io` module is designed to easly and quickly open Tiff files and to be able to parse and import any kind of metadata. Finally, an OME module is provided to read and write OME xml metadata. See https://www.openmicroscopy.org/site/support/ome-model/ for details. """ # Remove warnings for tifffile.py impor...
Remove warning messages for tifffile.py
Remove warning messages for tifffile.py
Python
bsd-3-clause
bnoi/scikit-tracker,bnoi/scikit-tracker,bnoi/scikit-tracker
6ab4fc7af637976a92846005c4d1d35693e893a0
rivescript/__main__.py
rivescript/__main__.py
#!/usr/bin/env python from __future__ import absolute_import """RiveScript's __main__.py This script is executed when you run `python rivescript` directly. It does nothing more than load the interactive mode of RiveScript.""" __docformat__ = 'plaintext' from rivescript.interactive import interactive_mode if __nam...
#!/usr/bin/env python from __future__ import absolute_import """RiveScript's __main__.py This script is executed when you run `python rivescript` directly. It does nothing more than load the interactive mode of RiveScript.""" __docformat__ = 'plaintext' # Boilerplate to allow running as script directly. # See: htt...
Fix running the module directly
Fix running the module directly After rearranging the package structure, running the rivescript module directly stopped working due to relative import errors. Fix it so that it can be run directly while still working when imported as normal.
Python
mit
Dinh-Hung-Tu/rivescript-python,FujiMakoto/makoto-rivescript,aichaos/rivescript-python,FujiMakoto/makoto-rivescript,plasmashadow/rivescript-python,aichaos/rivescript-python,FujiMakoto/makoto-rivescript,plasmashadow/rivescript-python,aichaos/rivescript-python,plasmashadow/rivescript-python,Dinh-Hung-Tu/rivescript-python,...
6ebb2b021594633a66f2ff90121d4a39eec96cc8
test_project/test_project/urls.py
test_project/test_project/urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^', include('test_app.urls')), )
from django.conf.urls import patterns, include, url from django.http import HttpResponseNotFound # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^', include('test_app.urls')), ) def custom404(request): return HttpR...
Use a custom 404 handler to avoid using the default template loader.
Use a custom 404 handler to avoid using the default template loader.
Python
mit
liberation/django-elasticsearch,leotsem/django-elasticsearch,sadnoodles/django-elasticsearch,alsur/django-elasticsearch
399e8ae093034ca69030f15dff8e9b570baf0cf5
paper_to_git/database.py
paper_to_git/database.py
from peewee import SqliteDatabase, OperationalError __all__ = [ 'BaseDatabase', ] class BaseDatabase: """The base database class to be used with Peewee. """ def __init__(self, url=None): self.url = url self.db = SqliteDatabase(None) def initialize(self, url=None): if...
from peewee import SqliteDatabase, OperationalError __all__ = [ 'BaseDatabase', ] class BaseDatabase: """The base database class to be used with Peewee. """ def __init__(self, url=None): self.url = url self.db = SqliteDatabase(None) def initialize(self, url=None): if...
Add model Sync to repo.
Add model Sync to repo.
Python
apache-2.0
maxking/paper-to-git,maxking/paper-to-git
9ec465771ed3b6b1b0be85468f73086fcfdbb76d
siemstress/__init__.py
siemstress/__init__.py
__version__ = '0.4-alpha' __author__ = 'Dan Persons <dpersonsdev@gmail.com>' __license__ = 'MIT License' __github__ = 'https://github.com/dogoncouch/siemstress' __all__ = ['parsecore', 'querycore', 'query', 'triggercore', 'trigger'] import siemstress.query import siemstress.trigger
__version__ = '0.4-alpha' __author__ = 'Dan Persons <dpersonsdev@gmail.com>' __license__ = 'MIT License' __github__ = 'https://github.com/dogoncouch/siemstress' __all__ = ['parsecore', 'querycore', 'query', 'triggercore', 'trigger', 'util'] import siemstress.query import siemstress.trigger import siemstress.ut...
Add util module for DB testing
Add util module for DB testing
Python
mit
dogoncouch/siemstress
450e9415f90c92d64f814c363248db8250c5a8f2
rest_framework_json_api/mixins.py
rest_framework_json_api/mixins.py
""" Class Mixins. """ class MultipleIDMixin(object): """ Override get_queryset for multiple id support """ def get_queryset(self): """ Override :meth:``get_queryset`` """ ids = dict(getattr(self.request, 'query_params', self.request.QUERY_PARAMS)).get('ids[]') if...
""" Class Mixins. """ class MultipleIDMixin(object): """ Override get_queryset for multiple id support """ def get_queryset(self): """ Override :meth:``get_queryset`` """ if hasattr(self.request, 'query_params'): ids = dict(self.request.query_params).get('ids...
Fix for deprecation of `request.QUERY_PARAMS` in DRF 3.2`
Fix for deprecation of `request.QUERY_PARAMS` in DRF 3.2`
Python
bsd-2-clause
grapo/django-rest-framework-json-api,aquavitae/django-rest-framework-json-api,scottfisk/django-rest-framework-json-api,Instawork/django-rest-framework-json-api,lukaslundgren/django-rest-framework-json-api,django-json-api/django-rest-framework-json-api,leo-naeka/django-rest-framework-json-api,django-json-api/django-rest...
9fcd338b568ec46ac16661a9aa497e619c092eeb
setup.py
setup.py
from distutils.core import setup setup(name='dshelpers', version='1.1.0', description="Provides some helpers functions used by the ScraperWiki Data Services team.", long_description="Provides some helpers functions used by the ScraperWiki Data Services team.", classifiers=["Development Status ::...
from distutils.core import setup setup(name='dshelpers', version='1.1.0', description="Provides some helpers functions used by the ScraperWiki Data Services team.", long_description="Provides some helpers functions used by the ScraperWiki Data Services team.", classifiers=["Development Status ::...
Change URL from ScraperWiki > source
Change URL from ScraperWiki > source
Python
bsd-2-clause
scraperwiki/data-services-helpers
f562e0d2f258df59b9bfb74a5d18424a42bea65d
seleniumbase/config/proxy_list.py
seleniumbase/config/proxy_list.py
""" Proxy Server "Phone Book". Simplify running browser tests through a proxy server by adding your frequently-used proxies here. Now you can do something like this on the command line: "pytest SOME_TEST.py --proxy=proxy1" Format of PROXY_LIST server entries: * "ip_address:port" OR "username:password@ip_address:po...
""" Proxy Server "Phone Book". Simplify running browser tests through a proxy server by adding your frequently-used proxies here. Now you can do something like this on the command line: "pytest SOME_TEST.py --proxy=proxy1" Format of PROXY_LIST server entries: * "ip_address:port" OR "username:password@ip_address:po...
Update the proxy server examples
Update the proxy server examples
Python
mit
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase
8b4fc00e7a5ac1d416d54952cbb6d09ef328a9c3
cache_keras_weights.py
cache_keras_weights.py
from keras.applications.resnet50 import ResNet50 from keras.applications.vgg16 import VGG16 from keras.applications.vgg19 import VGG19 from keras.applications.inception_v3 import InceptionV3 resnet = ResNet50(weights='imagenet') vgg16 = VGG16(weights='imagenet') vgg19 = VGG19(weights='imagenet') inception = InceptionV...
from keras.applications.resnet50 import ResNet50 from keras.applications.vgg16 import VGG16 from keras.applications.vgg19 import VGG19 from keras.applications.inception_v3 import InceptionV3 from keras.applications.xception import Xception resnet = ResNet50(weights='imagenet') vgg16 = VGG16(weights='imagenet') vgg19 =...
Add Xception to keras cache
Add Xception to keras cache
Python
apache-2.0
Kaggle/docker-python,Kaggle/docker-python
e5ac63b4615b4166d7e7866c9f169e4c9f86f46c
setup.py
setup.py
from distutils.core import setup setup( name='django-emailuser', version='1.0', description='simple User model identified by email address', packages=['emailuser'], author='Mark Paschal', author_email='markpasc@markpasc.org', url='https://github.com/duncaningram/django-emailuser', cl...
from distutils.core import setup setup( name='django-emailuser', version='1.0', description='simple User model identified by email address', packages=['emailuser', 'emailuser.management', 'emailuser.management.commands'], author='Mark Paschal', author_email='markpasc@markpasc.org', url='h...
Install the management command too when installing as a distribution
Install the management command too when installing as a distribution
Python
mit
markpasc/django-emailuser,duncaningram/django-emailuser
1a13e9da4e3955aaa7c52792d91638966d29de9c
sensor_consumers/bathroom_door.py
sensor_consumers/bathroom_door.py
# coding=utf-8 from local_settings import * from utils import SensorConsumerBase import redis import datetime import sys class Bathroom(SensorConsumerBase): def __init__(self): SensorConsumerBase.__init__(self, "bathroom") def run(self): self.subscribe("bathroom-pubsub", self.pubsub_callback)...
# coding=utf-8 from local_settings import * from utils import SensorConsumerBase import redis import datetime import sys class Bathroom(SensorConsumerBase): def __init__(self): SensorConsumerBase.__init__(self, "indoor_air_quality") def run(self): self.subscribe("bathroom-pubsub", self.pubsub...
Use a single database for all air quality measurements
Use a single database for all air quality measurements
Python
bsd-3-clause
ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display
13c26818cbb217ac4e27b94f188f239152fa85b8
timer.py
timer.py
#!/usr/bin/env python # encoding: utf-8 from __future__ import division, print_function from time import time class Timer(object): """ Simple timing object. Usage: with Timer('Function took'): do_something() """ def __init__(self, msg='Timer'): """ :msg: Additio...
#!/usr/bin/env python # encoding: utf-8 from __future__ import division, print_function from time import time class Timer(object): """ Simple timing object. Usage: with Timer('Function took'): do_something() """ def __init__(self, msg='Timer'): """ :msg: Additio...
Set start variable in init function
Set start variable in init function
Python
unlicense
dseuss/pythonlibs
af59d91afdddf9a5f3f673dd7bba98ad4538ec55
go_store_service/tests/test_api_handler.py
go_store_service/tests/test_api_handler.py
from unittest import TestCase from go_store_service.api_handler import ( ApiApplication, create_urlspec_regex, CollectionHandler, ElementHandler) class TestCreateUrlspecRegex(TestCase): def test_no_variables(self): self.assertEqual(create_urlspec_regex("/foo/bar"), "/foo/bar") class TestApiAppl...
from unittest import TestCase from go_store_service.api_handler import ( ApiApplication, create_urlspec_regex, CollectionHandler, ElementHandler) class TestCreateUrlspecRegex(TestCase): def test_no_variables(self): self.assertEqual(create_urlspec_regex("/foo/bar"), "/foo/bar") def test_one_v...
Add test for passing paths with variables to create_urlspec_regex.
Add test for passing paths with variables to create_urlspec_regex.
Python
bsd-3-clause
praekelt/go-store-service
539fae27f9911b9ad13edc5244ffbd12b1509006
utils.py
utils.py
""" Author(s): Matthew Loper See LICENCE.txt for licensing and contact information. """ __all__ = ['mstack', 'wget'] def mstack(vs, fs): import chumpy as ch import numpy as np lengths = [v.shape[0] for v in vs] f = np.vstack([fs[i]+np.sum(lengths[:i]).astype(np.uint32) for i in range(len(fs))]) v ...
""" Author(s): Matthew Loper See LICENCE.txt for licensing and contact information. """ __all__ = ['mstack', 'wget'] def mstack(vs, fs): import chumpy as ch import numpy as np lengths = [v.shape[0] for v in vs] f = np.vstack([fs[i]+np.sum(lengths[:i]).astype(np.uint32) for i in range(len(fs))]) v ...
Fix for python2/3 compatibility issue with urllib
Fix for python2/3 compatibility issue with urllib
Python
mit
mattloper/opendr,mattloper/opendr
69d1f91c48ab022a56232debdec14f5a5a449cbc
src/handlers/custom.py
src/handlers/custom.py
import flask from handlers import app import db.query as q @app.route('/') def index(): return app.send_static_file('index.html') @app.route('/api/perspective/random') def random_perspective(): return flask.jsonify( q.random_perspective().to_dict() )
import flask from handlers import app import db.query as q @app.route('/') def index(): return app.send_static_file('index.html') @app.route('/api/perspective/random') def random_perspective(): random_id = q.random_perspective().id return flask.redirect('/api/perspective/%s' % random_id) @app.route('/api/roun...
Use flask redirects for random perspective and latest round
Use flask redirects for random perspective and latest round
Python
apache-2.0
pascalc/narrative-roulette,pascalc/narrative-roulette
cf20a04b0fb50993e746945f586160b96a0f16b1
magnum/api/validation.py
magnum/api/validation.py
# Copyright 2015 Huawei Technologies Co.,LTD. # # 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...
# Copyright 2015 Huawei Technologies Co.,LTD. # # 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...
Correct the usage of decorator.decorator
Correct the usage of decorator.decorator Correct the usage of decorator.decorator as described in [1]. [1]http://pythonhosted.org/decorator/documentation.html#decorator-decorator Change-Id: Ia71b751f364e09541faecf6a43f252e0b856558e Closes-Bug: #1483464
Python
apache-2.0
Alzon/SUR,eshijia/SUR,jay-lau/magnum,dimtruck/magnum,ArchiFleKs/magnum,Tennyson53/magnum,Alzon/SUR,eshijia/magnum,Tennyson53/magnum,ddepaoli3/magnum,annegentle/magnum,ramielrowe/magnum,eshijia/magnum,ArchiFleKs/magnum,openstack/magnum,ramielrowe/magnum,mjbrewer/testindex,mjbrewer/testindex,Tennyson53/SUR,ffantast/magnu...
daeb8e38ec5b15650b9c5933789b6eab14b4a0a8
website/jdevents/models.py
website/jdevents/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from mezzanine.core.models import Displayable, RichText class Event(Displayable, RichText): """ Main object for each event. Derives from Displayable, which by default - it is related to a certain Site ob...
from django.db import models from django.utils.translation import ugettext_lazy as _ from mezzanine.core.models import Displayable, RichText class Event(Displayable, RichText): """ Main object for each event. Derives from Displayable, which by default - it is related to a certain Site ob...
Add posibility to add extra information to occurence.
Add posibility to add extra information to occurence.
Python
mit
jonge-democraten/website,jonge-democraten/website,jonge-democraten/website,jonge-democraten/website
2b07fdcefdc915e69580016d9c0a08ab8e478ce7
chatterbot/adapters/logic/closest_match.py
chatterbot/adapters/logic/closest_match.py
# -*- coding: utf-8 -*- from .base_match import BaseMatchAdapter from fuzzywuzzy import fuzz class ClosestMatchAdapter(BaseMatchAdapter): """ The ClosestMatchAdapter creates a response by using fuzzywuzzy's process class to extract the most similar response to the input. This adapter selects a respons...
# -*- coding: utf-8 -*- from .base_match import BaseMatchAdapter from fuzzywuzzy import fuzz class ClosestMatchAdapter(BaseMatchAdapter): """ The ClosestMatchAdapter creates a response by using fuzzywuzzy's process class to extract the most similar response to the input. This adapter selects a respons...
Remove commented out method call.
Remove commented out method call.
Python
bsd-3-clause
Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,Gustavo6046/ChatterBot,vkosuri/ChatterBot,gunthercox/ChatterBot,Reinaesaya/OUIRL-ChatBot,davizucon/ChatterBot
a6441de03522f9352742cba5a8a656785de05455
tests/mock_vws/test_query.py
tests/mock_vws/test_query.py
""" Tests for the mock of the query endpoint. https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query. """ import pytest import requests from tests.mock_vws.utils import Endpoint, assert_query_success @pytest.mark.usefixtures('verify_mock_vuforia') class TestQuery: """ Tests...
""" Tests for the mock of the query endpoint. https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query. """ import io from urllib.parse import urljoin import pytest import requests from requests_mock import POST from urllib3.filepost import encode_multipart_formdata from tests.mock_vw...
Use raw request making in query test
Use raw request making in query test
Python
mit
adamtheturtle/vws-python,adamtheturtle/vws-python
d3ebf779f3da800145e84913cb202a1e508c9d30
abelfunctions/__init__.py
abelfunctions/__init__.py
""" abelfunctions is a Python library for computing with Abelian functions, algebraic curves, and solving integrable Partial Differential Equations. The code is available as a git repository at https://github.com/cswiercz/abelfunctions """ # from puiseux import puiseux # from integralbasis import integral_basis ...
""" abelfunctions is a Python library for computing with Abelian functions, algebraic curves, and solving integrable Partial Differential Equations. The code is available as a git repository at https://github.com/cswiercz/abelfunctions """ from riemann_surface import RiemannSurface from riemanntheta import Riema...
Make 'from abelfunctions import *' work.
Make 'from abelfunctions import *' work.
Python
mit
abelfunctions/abelfunctions,cswiercz/abelfunctions,cswiercz/abelfunctions,abelfunctions/abelfunctions,cswiercz/abelfunctions,abelfunctions/abelfunctions
4e2237d53d3f78e1cc11aeba1a1599c296e0c280
tests/integration/test_wordpress_import.py
tests/integration/test_wordpress_import.py
# -*- coding: utf-8 -*- """ Testing the wordpress import. It will do create a new site with the import_wordpress command and use that newly created site to make a build. """ import os import os.path import pytest from nikola import __main__ from ..base import cd from .test_empty_build import ( # NOQA test_arc...
# -*- coding: utf-8 -*- """ Testing the wordpress import. It will do create a new site with the import_wordpress command and use that newly created site to make a build. """ import os.path from glob import glob import pytest from nikola import __main__ from ..base import cd from .test_empty_build import ( # NOQA ...
Test that pages and posts are filled.
Test that pages and posts are filled.
Python
mit
getnikola/nikola,getnikola/nikola,getnikola/nikola,okin/nikola,okin/nikola,okin/nikola,okin/nikola,getnikola/nikola
db1af67bab58b831dcf63f63bfefc0e28e4ced55
congress_tempest_tests/config.py
congress_tempest_tests/config.py
# Copyright 2015 Intel Corp # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
# Copyright 2015 Intel Corp # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
Add congress to service_available group
Add congress to service_available group Add congress to service_available group. used in tempest plugin to check if service is available or not Change-Id: Ia3edbb545819d76a6563ee50c2dcdad6013f90e9
Python
apache-2.0
ramineni/my_congress,ramineni/my_congress,ramineni/my_congress,ramineni/my_congress,openstack/congress,openstack/congress
609864faf36b9a82db9fd63d28b5a0da7a22c4f5
eforge/__init__.py
eforge/__init__.py
# -*- coding: utf-8 -*- # EForge project management system, Copyright © 2010, Element43 # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWA...
# -*- coding: utf-8 -*- # EForge project management system, Copyright © 2010, Element43 # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWA...
Change master version information to 0.5.99 (git master)
Change master version information to 0.5.99 (git master) Todo: We should probably add the smarts to EForge to grab the git revision for master, at least if Dulwich is installed :-)
Python
isc
oshepherd/eforge,oshepherd/eforge,oshepherd/eforge
b6645c81c4e45a03297ebb5e4fb65fcef952a1f9
ci/get_latest_conda_build_path.py
ci/get_latest_conda_build_path.py
import sys import os import yaml import jinja2 import glob from conda_build.config import config from conda_build.metadata import MetaData from distutils.version import LooseVersion recipe_metadata = MetaData(os.path.join(sys.argv[1])) binary_package_glob = os.path.join(config.bldpkgs_dir, '{0}*.tar.bz2'.format(recipe...
import sys import os import yaml import jinja2 import glob from conda_build.config import Config from conda_build.metadata import MetaData from distutils.version import LooseVersion config = Config() recipe_metadata = MetaData(os.path.join(sys.argv[1])) binary_package_glob = os.path.join(config.bldpkgs_dir, '{0}*.tar....
Update get build path script for conda-build 2.0
Update get build path script for conda-build 2.0 In conda-build 2.0 the config API changed.
Python
bsd-3-clause
amacd31/hydromath,amacd31/hydromath
f4550e5a341baab9b1193766595a86d57e253806
rnacentral/apiv1/urls.py
rnacentral/apiv1/urls.py
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute 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 a...
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute 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 a...
Add url namespaces and app_names to apiv1
Add url namespaces and app_names to apiv1
Python
apache-2.0
RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode
1ff766471df0c0171722c97f21ea1033f21e44f3
src/valid_parentheses.py
src/valid_parentheses.py
def isValid( s): if not s: return False stack = [] map = {'(':')', '[':']', '{':'}'} for c in s: if c in map.keys(): stack.append(c) else: if len(stack) > 0: top = stack.pop() if map[top] != c: return F...
""" Source : https://oj.leetcode.com/problems/valid-parentheses/ Author : Changxi Wu Date : 2015-01-20 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "...
Add question desciption for valid parentheses
Add question desciption for valid parentheses
Python
mit
chancyWu/leetcode
eacc79f1e1a7a0748d9202eb2c9a90291abe3fd7
dwitter/templatetags/insert_magic_links.py
dwitter/templatetags/insert_magic_links.py
import re from django import template register = template.Library() def to_link(m): text = m.group('text') dweet_id = m.group('dweet_id') username = m.group('username') if username is None: path = '/d/' + dweet_id # hardcode for speed! # path = reverse('dweet_show', kwargs={'dweet_i...
import re from django import template register = template.Library() def to_link(m): text = m.group('text') dweet_id = m.group('dweet_id') username = m.group('username') if username is None: url = 'd/' + dweet_id else: url = 'u/' + username result = '<a href="/{0}">{0}</a>'.f...
Update magic links for dweet and user links
Update magic links for dweet and user links
Python
apache-2.0
lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter
48d02d2c9cea083946c68e494309d7597ec2d878
pyfire/tests/__init__.py
pyfire/tests/__init__.py
# -*- coding: utf-8 -*- """ pyfire.tests ~~~~~~~~~~~~ All unittests live here :copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """
# -*- coding: utf-8 -*- """ pyfire.tests ~~~~~~~~~~~~ All unittests live here :copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import unittest class PyfireTestCase(unittest.TestCase): """All our unittests are based on thi...
Create unit test base class
Create unit test base class
Python
bsd-3-clause
IgnitedAndExploded/pyfire,IgnitedAndExploded/pyfire
7e2b60a7f7b32c235f931f9e7263ccefc84c79e2
gittip/orm/__init__.py
gittip/orm/__init__.py
from __future__ import unicode_literals import os import pdb from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session class Model(object): def __repr__(self): cols = self.__mapper__.c.keys() class...
from __future__ import unicode_literals import os import pdb from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session class Model(object): def __repr__(self): cols = self.__mapper__.c.keys() class...
Add convenience methods for creating/deleting all tables, for bootstrapping/testing use
Add convenience methods for creating/deleting all tables, for bootstrapping/testing use Signed-off-by: Joonas Bergius <9be13466ab086d7a8db93edb14ffb6760790b15e@gmail.com>
Python
mit
studio666/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,MikeFair/www.gittip.com,MikeFair/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,bountysource/www.gittip.com,eXcomm/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,gratipay/gratipay.com,bountysource/www.gittip.com,MikeFair/www.git...
6c8122be60b25bbe9ba4ff8a714370e801e6ae70
cufflinks/offline.py
cufflinks/offline.py
import plotly.offline as py_offline ### Offline Mode def go_offline(connected=False): try: py_offline.init_notebook_mode(connected) except TypeError: #For older versions of plotly py_offline.init_notebook_mode() py_offline.__PLOTLY_OFFLINE_INITIALIZED=True def go_online(): py_offline.__PLOTLY_OFFLINE_INIT...
import plotly.offline as py_offline ### Offline Mode def run_from_ipython(): try: __IPYTHON__ return True except NameError: return False def go_offline(connected=False): if run_from_ipython(): try: py_offline.init_notebook_mode(connected) except TypeE...
Call init_notebook_mode only if inside IPython
Call init_notebook_mode only if inside IPython
Python
mit
santosjorge/cufflinks
979ec05ed34cec2af0d45dc76b84921af85f84e9
script/compile-coffee.py
script/compile-coffee.py
#!/usr/bin/env python import os import subprocess import sys from lib.util import * SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) def main(): input_file = sys.argv[1] output_dir = os.path.dirname(sys.argv[2]) coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin', ...
#!/usr/bin/env python import os import subprocess import sys from lib.util import * SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) def main(): input_file = sys.argv[1] output_dir = os.path.dirname(sys.argv[2]) coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin', ...
Fix running node from python.
[Win] Fix running node from python. There is a mysterious "WindowsError [error 5] Access is denied" error is the "executable" is not specified under Windows.
Python
mit
mjaniszew/electron,meowlab/electron,rreimann/electron,eriser/electron,tonyganch/electron,nicholasess/electron,wolfflow/electron,thingsinjars/electron,dongjoon-hyun/electron,rhencke/electron,Evercoder/electron,yan-foto/electron,mattdesl/electron,pirafrank/electron,nagyistoce/electron-atom-shell,bitemyapp/electron,Andrey...
785fcdca3c9bfb908444d3b9339457c616761f2c
tests/flights_to_test.py
tests/flights_to_test.py
import unittest import datetime import json import sys sys.path.append('..') import sabre_dev_studio import sabre_dev_studio.sabre_exceptions as sabre_exceptions ''' requires config.json in the same directory for api authentication { "sabre_client_id": -----, "sabre_client_secret": ----- } ''' class TestBasicInst...
import unittest import datetime import json import sys sys.path.append('..') import sabre_dev_studio import sabre_dev_studio.sabre_exceptions as sabre_exceptions ''' requires config.json in the same directory for api authentication { "sabre_client_id": -----, "sabre_client_secret": ----- } ''' class TestBasicFlig...
Change instaflights name in flights_to tests
Change instaflights name in flights_to tests
Python
mit
Jamil/sabre_dev_studio
65f5695b90054f73d7119f0c50be51f61de777fa
tardis/tests/tests_slow/runner.py
tardis/tests/tests_slow/runner.py
import argparse import json import os import time import requests from tardis import __githash__ as tardis_githash parser = argparse.ArgumentParser(description="Run slow integration tests") parser.add_argument("--yaml", dest="yaml_filepath", help="Path to YAML config file for integration tests.")...
import argparse import datetime import json import os import time import requests from tardis import __githash__ as tardis_githash parser = argparse.ArgumentParser(description="Run slow integration tests") parser.add_argument("--yaml", dest="yaml_filepath", help="Path to YAML config file for inte...
Print the time of checking status at github.
Print the time of checking status at github.
Python
bsd-3-clause
kaushik94/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,kaushik94/tardis
0d38b9592fbb63e25b080d2f17b690c478042455
google-code-jam-2012/perfect-game/perfect-game.py
google-code-jam-2012/perfect-game/perfect-game.py
#!/usr/bin/env python import sys if len(sys.argv) < 2: sys.exit('Usage: %s file.in' % sys.argv[0]) file = open(sys.argv[1], 'r') T = int(file.readline()) for i in xrange(1, T+1): N = int(file.readline()) L = map(int, file.readline().split(' ')) P = map(int, file.readline().split(' ')) assert N == len(L)...
#!/usr/bin/env python # expected time per attempt is given by equation # time = L[0] + (1-P[0])*L[1] + (1-P[0])*(1-P[1])*L[2] + ... # where L is the expected time and P is the probability of failure, per level # swap two levels if L[i]*P[i+1] > L[i+1]*P[i] import sys if len(sys.argv) < 2: sys.exit('Usage: %s file....
Add comments to Perfect Game solution
Add comments to Perfect Game solution
Python
mit
robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles
4d247da1ecd39bcd699a55b5387412a1ac9e1582
txlege84/topics/management/commands/bootstraptopics.py
txlege84/topics/management/commands/bootstraptopics.py
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
Split Energy and Environment, change Civil Liberties to Social Justice
Split Energy and Environment, change Civil Liberties to Social Justice
Python
mit
texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84
224abc99becc1683605a6dc5c3460510efef3efb
tests/test_pyserial.py
tests/test_pyserial.py
from __future__ import (absolute_import, print_function, unicode_literals) import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) import io import struct import unittest import threading import time import serial try: import unittest2 as unittest except ImportError: import unittest ...
from __future__ import (absolute_import, print_function, unicode_literals) import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) import io import struct import unittest import threading import time import serial try: import unittest2 as unittest except ImportError: import unittest ...
Comment out the pyserial TestIsCorrectVariant test.
Comment out the pyserial TestIsCorrectVariant test.
Python
agpl-3.0
Jnesselr/s3g,makerbot/s3g,Jnesselr/s3g,makerbot/s3g,makerbot/s3g,makerbot/s3g
e716a71bad4e02410e2a0908d630abbee1d4c691
django/contrib/admin/__init__.py
django/contrib/admin/__init__.py
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options import StackedInline, TabularInline from django.contrib.admin.sites import AdminSite, site def autodiscover(): """ Auto-discover INSTALLED_APPS admin.py modules and fail silently when not present. T...
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here # has been referenced in documentation. from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options import StackedInline, TabularInli...
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong.
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong. git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Python
bsd-3-clause
schinckel/django,DasIch/django,coldmind/django,rwillmer/django,jpic/django,techdragon/django,abomyi/django,EmadMokhtar/Django,koniiiik/django,auvipy/django,elkingtonmcb/django,Balachan27/django,jscn/django,darkryder/django,lunafeng/django,sergei-maertens/django,Leila20/django,chyeh727/django,huang4fstudio/django,saydul...
0d7add686605d9d86e688f9f65f617555282ab60
opwen_email_server/backend/email_sender.py
opwen_email_server/backend/email_sender.py
from typing import Tuple from opwen_email_server import azure_constants as constants from opwen_email_server import config from opwen_email_server.services.queue import AzureQueue from opwen_email_server.services.sendgrid import SendgridEmailSender QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K...
from typing import Tuple from opwen_email_server import azure_constants as constants from opwen_email_server import config from opwen_email_server.services.queue import AzureQueue from opwen_email_server.services.sendgrid import SendgridEmailSender QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K...
Add debugging CLI hook for email sending
Add debugging CLI hook for email sending
Python
apache-2.0
ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver
cc6c80ad64fe7f4d4cb2b4e367c595f1b08f9d3b
i3blocks-sonos.py
i3blocks-sonos.py
#!/usr/bin/env python3 # # By Henrik Lilleengen (mail@ithenrik.com) # # Released under the MIT License: https://opensource.org/licenses/MIT import soco, sys speakers = list(soco.discover()) state = speakers[0].get_current_transport_info()['current_transport_state'] if state == 'PLAYING': if len(sys.argv) > 1 a...
#!/usr/bin/env python3 # # By Henrik Lilleengen (mail@ithenrik.com) # # Released under the MIT License: https://opensource.org/licenses/MIT import soco, sys speakers = list(soco.discover()) if len(speakers) > 0: state = speakers[0].get_current_transport_info()['current_transport_state'] if state == 'PLAYING...
Remove script crash when no sonos is found
Remove script crash when no sonos is found
Python
mit
Lilleengen/i3blocks-sonos
ce48ef985a8e79d0cd636abf2116917fde24d6d2
candidates/tests/test_posts_view.py
candidates/tests/test_posts_view.py
from __future__ import unicode_literals from django_webtest import WebTest from .uk_examples import UK2015ExamplesMixin class TestPostsView(UK2015ExamplesMixin, WebTest): def setUp(self): super(TestPostsView, self).setUp() def test_single_election_posts_page(self): response = self.app.get...
from __future__ import unicode_literals from django_webtest import WebTest from .uk_examples import UK2015ExamplesMixin class TestPostsView(UK2015ExamplesMixin, WebTest): def test_single_election_posts_page(self): response = self.app.get('/posts') self.assertTrue( response.html.fi...
Remove an unnecessary method override
Remove an unnecessary method override
Python
agpl-3.0
DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextr...
014925aa73e85fe3cb0d939a3d5d9c30424e32b4
func.py
func.py
# PyArt by MohamadKh75 # 2017-10-05 # ******************** from pathlib import Path # Set the Alphabet folder path folder_path = Path("Alphabet").resolve() # Read all Capital Letters - AA is Capital A def letter_reader(letter): # if it's Capital - AA is Capital A if 65 <= ord(letter) <= 90: letter_...
# PyArt by MohamadKh75 # 2017-10-05 # ******************** from pathlib import Path # Set the Alphabet folder path folder_path = Path("Alphabet").resolve() # Read all Capital Letters - AA is Capital A def letter_reader(letter): # if it's Capital - AA is Capital A if 65 <= ord(letter) <= 90: letter_...
Add Numbers and Symbols Exception
Add Numbers and Symbols Exception
Python
mit
MohamadKh75/Arthon
f0e29748ff899d7e65d1f4169e890d3e3c4bda0e
icekit/project/settings/_test.py
icekit/project/settings/_test.py
from ._base import * # DJANGO ###################################################################### DATABASE_NAME = 'test_%s' % DATABASES['default']['NAME'] DATABASES = { 'default': { 'NAME': DATABASE_NAME, 'TEST': { 'NAME': DATABASE_NAME, # See: https://docs.djangoprojec...
from ._base import * # DJANGO ###################################################################### DATABASE_NAME = 'test_%s' % DATABASES['default']['NAME'] DATABASES['default'].update({ 'NAME': DATABASE_NAME, 'TEST': { 'NAME': DATABASE_NAME, # See: https://docs.djangoproject.com/en/1.7/ref/...
Update instead of overriding `DATABASES` setting in `test` settings.
Update instead of overriding `DATABASES` setting in `test` settings.
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
e637e5f53990709ed654b661465685ad9d05a182
api/spawner/templates/constants.py
api/spawner/templates/constants.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.conf import settings JOB_NAME = 'plxjob-{task_type}{task_idx}-{experiment_uuid}' DEFAULT_PORT = 2222 ENV_VAR_TEMPLATE = '{name: "{var_name}", value: "{var_value}"}' VOLUME_NAME = 'pv-{vol_name}' VOLUME_CLAIM_NAME = 'p...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.conf import settings JOB_NAME = 'plxjob-{task_type}{task_idx}-{experiment_uuid}' DEFAULT_PORT = 2222 ENV_VAR_TEMPLATE = '{name: "{var_name}", value: "{var_value}"}' VOLUME_NAME = 'pv-{vol_name}' VOLUME_CLAIM_NAME = 'p...
Update cluster config map key format
Update cluster config map key format
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
70d009834123cb5a10788763fed3193017cc8162
libpebble2/__init__.py
libpebble2/__init__.py
__author__ = 'katharine' from .exceptions import *
__author__ = 'katharine' import logging from .exceptions import * logging.getLogger('libpebble2').addHandler(logging.NullHandler())
Add a default null logger per python recommendations.
Add a default null logger per python recommendations.
Python
mit
pebble/libpebble2
60156236836944205f3993badcf179aaa6e7ae54
ehriportal/portal/api/handlers.py
ehriportal/portal/api/handlers.py
""" Piston handlers for notable resources. """ from piston.handler import BaseHandler from portal import models class RepositoryHandler(BaseHandler): model = models.Repository class CollectionHandler(BaseHandler): model = models.Collection class PlaceHandler(BaseHandler): model = models.Place clas...
""" Piston handlers for notable resources. """ from piston.handler import BaseHandler from portal import models class ResourceHandler(BaseHandler): model = models.Resource class RepositoryHandler(BaseHandler): model = models.Repository class CollectionHandler(BaseHandler): model = models.Collection ...
Add an (unexposed) ResourceHandler so inheriting objects serialise better
Add an (unexposed) ResourceHandler so inheriting objects serialise better
Python
mit
mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections
51f4d40cf6750d35f10f37d939a2c30c5f26d300
backend/scripts/updatedf.py
backend/scripts/updatedf.py
#!/usr/bin/env python #import hashlib import os def main(): for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: print f if __name__ == "__main__": main()
#!/usr/bin/env python import hashlib import os import rethinkdb as r def main(): conn = r.connect('localhost', 28015, db='materialscommons') for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: path = os.path.join(root, f) with open(path) as fd: ...
Update script to write results to the database.
Update script to write results to the database.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
923d49c753acf7d8945d6b79efbdb08363e130a2
noseprogressive/tests/test_utils.py
noseprogressive/tests/test_utils.py
from os import chdir, getcwd from os.path import dirname, basename from unittest import TestCase from nose.tools import eq_ from noseprogressive.utils import human_path, frame_of_test class UtilsTests(TestCase): """Tests for independent little bits and pieces""" def test_human_path(self): chdir(dir...
from os import chdir, getcwd from os.path import dirname, basename from unittest import TestCase from nose.tools import eq_ from noseprogressive.utils import human_path, frame_of_test class UtilsTests(TestCase): """Tests for independent little bits and pieces""" def test_human_path(self): chdir(dir...
Bring test_frame_of_test_null_file up to date with new signature of frame_of_test().
Bring test_frame_of_test_null_file up to date with new signature of frame_of_test().
Python
mit
pmclanahan/pytest-progressive,erikrose/nose-progressive,veo-labs/nose-progressive,olivierverdier/nose-progressive
e6af9d901f26fdf779a6a13319face483fe48a3b
dwitter/dweet/views.py
dwitter/dweet/views.py
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from dwitter.models import Dweet def fullscreen_dweet(request, dweet_id): dweet = get_obje...
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from dwitter.models import Dweet from django.views.decorators.clickjacking import xframe_opti...
Disable clickjacking protection on demos to display them in iframes
Disable clickjacking protection on demos to display them in iframes
Python
apache-2.0
lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter
d16373609b2f30c6ffa576c1269c529f12c9622c
backend/uclapi/timetable/urls.py
backend/uclapi/timetable/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^personal_fast$', views.get_personal_timetable_fast), url(r'^personal$', views.get_personal_timetable), url(r'^bymodule$', views.get_modules_timetable), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^personal$', views.get_personal_timetable_fast), url(r'^bymodule$', views.get_modules_timetable), ]
Switch to fast method for personal timetable
Switch to fast method for personal timetable
Python
mit
uclapi/uclapi,uclapi/uclapi,uclapi/uclapi,uclapi/uclapi
0812ec319291b709613152e9e1d781671047a428
config.py
config.py
import os SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] ACCESS_TOKEN = os.environ['ACCESS_TOKEN'] PAGE_ID = os.environ['PAGE_ID'] APP_ID = os.environ['APP_ID'] VERIFY_TOKEN = os.environ['VERIFY_TOKEN']
import os SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite://') ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN') PAGE_ID = os.environ.get('PAGE_ID') APP_ID = os.environ.get('APP_ID') VERIFY_TOKEN = os.environ.get('VERIFY_TOKEN')
Make server ignore missing environment variables
Make server ignore missing environment variables This is by far the best solution for setup, CI and testing purposes.
Python
mit
Stark-Mountain/meetup-facebook-bot,Stark-Mountain/meetup-facebook-bot
d7e03596f8bf1e886e984c0ea98334af878a15e2
meta/bytecodetools/print_code.py
meta/bytecodetools/print_code.py
''' Created on May 10, 2012 @author: sean ''' from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): print instr def main(): parser = ArgumentParser() parser.add_argument() if __name__ ==...
''' Created on May 10, 2012 @author: sean ''' from __future__ import print_function from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): print(instr) def main(): parser = ArgumentParser() ...
Use __future__.print_function so syntax is valid on Python 3
Use __future__.print_function so syntax is valid on Python 3
Python
bsd-3-clause
enthought/Meta,gutomaia/Meta
21149eb8d128c405d0b69991d1855e99ced951c7
ExperimentsManager/tests.py
ExperimentsManager/tests.py
from django.test import TestCase from .models import Experiment from UserManager.models import WorkbenchUser from django.contrib.auth.models import User from django.test import Client class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') ...
from django.test import TestCase from .models import Experiment from UserManager.models import WorkbenchUser from django.contrib.auth.models import User from django.test import Client class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') ...
Test fixed: WorkbenchUser is auto created by signal, so creating it separately is not required
Test fixed: WorkbenchUser is auto created by signal, so creating it separately is not required
Python
mit
MOOCworkbench/MOOCworkbench,MOOCworkbench/MOOCworkbench,MOOCworkbench/MOOCworkbench
32e83559e00b7d5a363585d599cd087af854c445
chainer/links/loss/crf1d.py
chainer/links/loss/crf1d.py
from chainer.functions.loss import crf1d from chainer import link from chainer import variable class CRF1d(link.Link): """Linear-chain conditional random field loss layer. This link wraps the :func:`~chainer.functions.crf1d` function. It holds a transition cost matrix as a parameter. Args: ...
from chainer.functions.loss import crf1d from chainer import link from chainer import variable class CRF1d(link.Link): """Linear-chain conditional random field loss layer. This link wraps the :func:`~chainer.functions.crf1d` function. It holds a transition cost matrix as a parameter. Args: ...
Support custom initializer in links.CRF1d
Support custom initializer in links.CRF1d
Python
mit
keisuke-umezawa/chainer,hvy/chainer,okuta/chainer,niboshi/chainer,niboshi/chainer,okuta/chainer,chainer/chainer,chainer/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,okuta/chainer,pfnet/chainer,tkerola/chainer,wkentaro/chainer,chainer/chainer,okuta/chainer,hvy/chainer,niboshi/chainer,hvy/chainer,chainer/chain...
8214d516b3feba92ab3ad3b1f2fa1cf253e83012
pyexcel/internal/__init__.py
pyexcel/internal/__init__.py
""" pyexcel.internal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pyexcel internals that subjected to change :copyright: (c) 2015-2017 by Onni Software Ltd. :license: New BSD License """ from lml.loader import scan_plugins from pyexcel.internal.plugins import PARSER, RENDERER # noqa from pyexcel.int...
""" pyexcel.internal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pyexcel internals that subjected to change :copyright: (c) 2015-2017 by Onni Software Ltd. :license: New BSD License """ from lml.loader import scan_plugins from pyexcel.internal.plugins import PARSER, RENDERER # noqa from pyexcel.int...
Remove use of deprecated `scan_plugins` method
Remove use of deprecated `scan_plugins` method `scan_plugins` has been deprecated in favour of `scan_plugins_regex`. This is causing warnings to be logged. The new method takes a regular expression as its first argument, rather than a simple prefix string. This commit adds a regular expression which does the s...
Python
bsd-3-clause
chfw/pyexcel,chfw/pyexcel
a23a1050501563889c2806a514fe2994a2ebe3a8
example/consume_many_csv_files.py
example/consume_many_csv_files.py
from __future__ import print_function from itertools import chain from itertools import imap import karld from karld.path import i_walk_csv_paths def main(): """ Consume many csv files as if one. """ import pathlib input_dir = pathlib.Path('test_data/things_kinds') # # Use a generator expr...
from __future__ import print_function from itertools import chain try: from itertools import imap except ImportError: # if python 3 imap = map import karld from karld.path import i_walk_csv_paths def main(): """ Consume many csv files as if one. """ import pathlib input_dir = pathl...
Add python3 support in example
Add python3 support in example
Python
apache-2.0
johnwlockwood/stream_tap,johnwlockwood/karl_data,johnwlockwood/stream_tap,johnwlockwood/iter_karld_tools
29384b927b620b7e943343409f62511451bb3059
neupy/algorithms/memory/utils.py
neupy/algorithms/memory/utils.py
from numpy import where __all__ = ('sign2bin', 'bin2sign', 'hopfield_energy') def sign2bin(matrix): return where(matrix == 1, 1, 0) def bin2sign(matrix): return where(matrix == 0, -1, 1) def hopfield_energy(weight, input_data, output_data): energy_output = -0.5 * input_data.dot(weight).dot(output_da...
from numpy import where, inner from numpy.core.umath_tests import inner1d __all__ = ('sign2bin', 'bin2sign', 'hopfield_energy') def sign2bin(matrix): return where(matrix == 1, 1, 0) def bin2sign(matrix): return where(matrix == 0, -1, 1) def hopfield_energy(weight, input_data, output_data): return -0...
Fix problem with Hopfield energy function for Python 2.7
Fix problem with Hopfield energy function for Python 2.7
Python
mit
stczhc/neupy,stczhc/neupy,itdxer/neupy,itdxer/neupy,stczhc/neupy,stczhc/neupy,itdxer/neupy,itdxer/neupy
981a74b116081f3ce1d97262c3c88104a953cdf4
saau/sections/misc/header.py
saau/sections/misc/header.py
import matplotlib.pyplot as plt from operator import gt, lt, itemgetter from lxml.etree import fromstring, XMLSyntaxError def frange(start, stop, step): cur = start op = gt if start > stop else lt while op(cur, stop): yield cur cur += step def parse_lines(lines): for line in lines: ...
import matplotlib.pyplot as plt from operator import itemgetter from lxml.etree import fromstring, XMLSyntaxError import numpy as np def parse_lines(lines): for line in lines: try: xml_line = fromstring(line.encode('utf-8')) except XMLSyntaxError: attrs = [] else:...
Use numpy's float supporting range
Use numpy's float supporting range
Python
mit
Mause/statistical_atlas_of_au
f4bbb244716f9471b520f53ebffaf34a31503cd1
Web/scripts/CPWeb/__init__.py
Web/scripts/CPWeb/__init__.py
""" CPWeb - A collection of commonly used routines to produce CoolProp's online documentation ===== """ from __future__ import division, absolute_import, print_function import codecs import csv import cStringIO def get_version(): return 5.0 if __name__ == "__main__": print('You are using version %s of the...
""" CPWeb - A collection of commonly used routines to produce CoolProp's online documentation ===== """ from __future__ import division, absolute_import, print_function def get_version(): return 5.0 if __name__ == "__main__": print('You are using version %s of the Python package for creating CoolProp\' onli...
Remove unused imports (besides they are Py 2.x only)
Remove unused imports (besides they are Py 2.x only)
Python
mit
CoolProp/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp
37ab58016e69993b5ab1d63c99d9afcf54bd95af
fireplace/cards/tgt/neutral_epic.py
fireplace/cards/tgt/neutral_epic.py
from ..utils import * ## # Minions # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t")
from ..utils import * ## # Minions # Twilight Guardian class AT_017: play = HOLDING_DRAGON & Buff(SELF, "AT_017e") # Sideshow Spelleater class AT_098: play = Summon(CONTROLLER, Copy(ENEMY_HERO_POWER)) # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t") # Master of Ceremonies class AT_117: pla...
Implement more TGT Neutral Epics
Implement more TGT Neutral Epics
Python
agpl-3.0
Meerkov/fireplace,Ragowit/fireplace,oftc-ftw/fireplace,liujimj/fireplace,oftc-ftw/fireplace,smallnamespace/fireplace,Ragowit/fireplace,Meerkov/fireplace,liujimj/fireplace,amw2104/fireplace,beheh/fireplace,amw2104/fireplace,NightKev/fireplace,smallnamespace/fireplace,jleclanche/fireplace
de381a56e87a21da1e82146da01bb546c5094ec4
scripts/asgard-deploy.py
scripts/asgard-deploy.py
#!/usr/bin/env python import sys import logging import click from os import path # Add top-level module path to sys.path before importing tubular code. sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) from tubular import asgard logging.basicConfig(stream=sys.stdout, level=logging.INFO) @cl...
#!/usr/bin/env python import sys import logging import traceback import click from os import path # Add top-level module path to sys.path before importing tubular code. sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) from tubular import asgard logging.basicConfig(stream=sys.stdout, level=l...
Print the traceback as well for debugging purposes.
Print the traceback as well for debugging purposes.
Python
agpl-3.0
eltoncarr/tubular,eltoncarr/tubular
6ad4796030aab2f6dbf8389b4030007d0fcf8761
panoptes/test/mount/test_ioptron.py
panoptes/test/mount/test_ioptron.py
from nose.tools import raises import panoptes from panoptes.mount.ioptron import Mount class TestIOptron(): @raises(AssertionError) def test_no_config_no_commands(self): """ Mount needs a config """ mount = Mount() @raises(AssertionError) def test_config_no_commands(self): """ """ mount = Mount(config={...
from nose.tools import raises import panoptes from panoptes.mount.ioptron import Mount class TestIOptron(): @raises(AssertionError) def test_no_config_no_commands(self): """ Mount needs a config """ mount = Mount() @raises(AssertionError) def test_config_bad_commands(self): """ Passes in a default config ...
Update to test for mount setup
Update to test for mount setup
Python
mit
Guokr1991/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,AstroHuntsman/POCS,panoptes/POCS,Guokr1991/POCS,Guokr1991/POCS,Guokr1991/POCS,panoptes/POCS,AstroHuntsman/POCS,panoptes/POCS,joshwalawender/POCS,AstroHuntsman/POCS,fmin2958/POCS,joshwalawender/POCS,fmin2958/POCS,fmin2958/POCS
24d4fee92c1c2ff4bac1fe09d9b436748234a48c
main.py
main.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ Main script. Executes the XML Server implementation with an HTTP connection and default parameters. """ import sys import argparse from server import xml_server from connection import http_connection parser = argparse.ArgumentParser() parser.add...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ Main script. Executes the XML Server implementation with an HTTP connection and default parameters. """ import sys import argparse from server import xml_server, defective_servers from connection import http_connection parser = argparse.Argument...
Add argument for execution of defective server.
Add argument for execution of defective server.
Python
apache-2.0
Solucionamos/dummybmc
52c2205804d8dc38447bca1ccbf5599e00cd1d7b
main.py
main.py
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class Bot: def __init__(self): self.config = Config(CONFIG_DIR) self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): self.api.send_message(self.config.get_user_id(), "test") class TelegramBotApi: de...
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class Bot: def __init__(self): self.config = Config(CONFIG_DIR) self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): self.api.send_message(self.config.get_admin_user_id(), "test") class TelegramBotApi: ...
Rename user_id config key to admin_user_id
Rename user_id config key to admin_user_id
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
bdca4889442e7d84f8c4e68ecdbee676d46ff264
examples/test_with_data_provider.py
examples/test_with_data_provider.py
from pytf.dataprovider import DataProvider try: from unittest.mock import call except ImportError: from mock import call @DataProvider([call(max=5), call(max=10), call(max=15)]) class TestCase(object): def __init__(self, max): self.max = max @DataProvider([call(n=3), call(n=7), call(n=12), c...
from pytf.dataprovider import DataProvider, call @DataProvider(max_5=call(max=5), max_10=call(max=10), max_15=call(max=15)) class TestCase(object): def __init__(self, max): self.max = max @DataProvider(n_3=call(n=3), n_7=call(n=7), n_12=call(n=12), n_20=call(n=20)) def test_test(self, n): ...
Fix data provider example file.
Fix data provider example file.
Python
mit
Lothiraldan/pytf
346e296872e1ca011eb5e469505de1c15c86732f
Doc/tools/sphinx-build.py
Doc/tools/sphinx-build.py
# -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: Python license. """ import sys if __name__ == '__main__': if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ Error: Sphinx ne...
# -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: Python license. """ import sys if __name__ == '__main__': if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ Error: Sphinx ne...
Clarify the comment about setting the PYTHON variable for the Doc Makefile.
Clarify the comment about setting the PYTHON variable for the Doc Makefile.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
547c9e36255870bcee8a800a3fa95c3806a95c2c
newsApp/linkManager.py
newsApp/linkManager.py
import os import time from constants import * from dbhelper import * from dbItemManagerV2 import DbItemManagerV2 from link import Link LINK_EXPIRY_TIME_IN_DAYS = 80 class LinkManager(DbItemManagerV2): """ Manage links stored on AWS dynamo db database. Contains functions for CRUD operations on the links ...
import os import time from constants import * from dbhelper import * from dbItemManagerV2 import DbItemManagerV2 from link import Link LINK_EXPIRY_TIME_IN_DAYS = 80 class LinkManager(DbItemManagerV2): """ Manage links stored on AWS dynamo db database. Contains functions for CRUD operations on the links ...
Update links when it starts getting redirected
Update links when it starts getting redirected
Python
mit
adityabansal/newsAroundMe,adityabansal/newsAroundMe,adityabansal/newsAroundMe
366ecdd77520004c307cbbf127bb374ab546ce7e
run-quince.py
run-quince.py
#!/usr/bin/env python3 # coding: utf-8 # Raytheon BBN Technologies 2016 # Contributiors: Graham Rowlands # # This file runs the main loop # Use PyQt5 by default import os os.environ["QT_API"] = 'pyqt5' from qtpy.QtWidgets import QApplication import sys import argparse from quince.view import * if __name__ == "__mai...
#!/usr/bin/env python3 # coding: utf-8 # Raytheon BBN Technologies 2016 # Contributiors: Graham Rowlands # # This file runs the main loop # Use PyQt5 by default import os os.environ["QT_API"] = 'pyqt5' from qtpy.QtWidgets import QApplication import sys import argparse import ctypes from quince.view import * if __na...
Use windows API to change the AppID and use our icon.
Use windows API to change the AppID and use our icon.
Python
apache-2.0
BBN-Q/Quince
7b3f239964c6663a9b655553202567fccead85c8
mollie/api/resources/profiles.py
mollie/api/resources/profiles.py
from ..error import IdentifierError from ..objects.profile import Profile from .base import Base class Profiles(Base): RESOURCE_ID_PREFIX = 'pfl_' def get_resource_object(self, result): return Profile(result, self.client) def get(self, profile_id, **params): if not profile_id or \ ...
from ..error import IdentifierError from ..objects.profile import Profile from .base import Base class Profiles(Base): RESOURCE_ID_PREFIX = 'pfl_' def get_resource_object(self, result): return Profile(result, self.client) def get(self, profile_id, **params): if not profile_id or \ ...
Add 'me' to profile IdentifierError
Add 'me' to profile IdentifierError
Python
bsd-2-clause
mollie/mollie-api-python
a2eae87fc76ba1e9fbfa8102c3e19c239445a62a
nazs/web/forms.py
nazs/web/forms.py
from achilles.forms import * # noqa from nazs.models import SingletonModel # Override forms template Form.template_name = 'web/form.html' class ModelForm(ModelForm): def get_form(self, form_data=None, *args, **kwargs): # manage SingletonModels if issubclass(self.form_class.Meta.model, Singleto...
from achilles.forms import * # noqa from nazs.models import SingletonModel # Override forms template Form.template_name = 'web/form.html' class ModelForm(ModelForm): def get_form(self, form_data=None, *args, **kwargs): # manage SingletonModels if issubclass(self.form_class.Meta.model, Singleto...
Fix form retrieval in ModelForm
Fix form retrieval in ModelForm
Python
agpl-3.0
exekias/droplet,exekias/droplet,exekias/droplet
b6dff8fcd7dec56703006f2a7bcf1c8c72d0c21b
price_security/models/invoice.py
price_security/models/invoice.py
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api class ac...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api class ac...
FIX price sec. related field as readonly
FIX price sec. related field as readonly
Python
agpl-3.0
ingadhoc/product,ingadhoc/product
38de795103748ca757a03a62da8ef3d89b0bf682
GoProController/models.py
GoProController/models.py
from django.db import models class Camera(models.Model): ssid = models.CharField(max_length=255) password = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) last_attempt = models.DateTimeField(auto_now=True) last_update = models.DateTimeField(null=True, blank=T...
from django.db import models class Camera(models.Model): ssid = models.CharField(max_length=255) password = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) last_attempt = models.DateTimeField(auto_now=True) last_update = models.DateTimeField(null=True, blank=T...
Fix bug that prevent commands with no values from being added
Fix bug that prevent commands with no values from being added
Python
apache-2.0
Nzaga/GoProController,joshvillbrandt/GoProController,Nzaga/GoProController,joshvillbrandt/GoProController
2e042201d6c0e0709d7056d399052389d1ea54b0
shopify_auth/__init__.py
shopify_auth/__init__.py
import shopify from django.conf import settings from django.core.exceptions import ImproperlyConfigured VERSION = (0, 1, 5) __version__ = '.'.join(map(str, VERSION)) __author__ = 'Gavin Ballard' def initialize(): if not settings.SHOPIFY_APP_API_KEY or not settings.SHOPIFY_APP_API_SECRET: raise Imp...
VERSION = (0, 1, 6) __version__ = '.'.join(map(str, VERSION)) __author__ = 'Gavin Ballard' def initialize(): import shopify from django.conf import settings from django.core.exceptions import ImproperlyConfigured if not settings.SHOPIFY_APP_API_KEY or not settings.SHOPIFY_APP_API_SECRET: ...
Move imports inside initialize() method so that we don’t break things on initial setup.
Move imports inside initialize() method so that we don’t break things on initial setup.
Python
mit
RafaAguilar/django-shopify-auth,discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth,funkybob/django-shopify-auth,funkybob/django-shopify-auth,discolabs/django-shopify-auth
f0e07f97fd43a0f54c8b0996944038a07e9a0e96
metering/loader.py
metering/loader.py
""" metering.loader ~~~~~~~~~ Define the meter data models """ from nemreader import read_nem_file from sqlalchemy.orm import sessionmaker from energy_shaper import split_into_daily_intervals from . import get_db_engine from . import save_energy_reading from . import refresh_daily_stats from . import refre...
""" metering.loader ~~~~~~~~~ Define the meter data models """ import logging from nemreader import read_nem_file from sqlalchemy.orm import sessionmaker from energy_shaper import split_into_daily_intervals from . import get_db_engine from . import save_energy_reading from . import refresh_daily_stats from...
Add error handling for when the meter name does not match the NEM file
Add error handling for when the meter name does not match the NEM file
Python
agpl-3.0
aguinane/energyusage,aguinane/energyusage,aguinane/energyusage,aguinane/energyusage
8064be72de340fca963da2cade2b73aa969fbdbd
csunplugged/activities/models.py
csunplugged/activities/models.py
from django.db import models class Activity(models.Model): name = models.CharField(max_length=200) description = models.TextField()
from django.db import models class Activity(models.Model): name = models.CharField(max_length=200) description = models.TextField() def __str__(self): return self.name
Add string representation for Activity model
Add string representation for Activity model
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
f20eb91dcf04bc8e33fbb48ebfbef1b56acbf02d
web.py
web.py
""" Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os from flask import Flask app = Flask(__name__) @app.route('/') def home_page(): return 'Hello from the SPARK learn-a-thon!' if __name__ == '__main__': port = int(os.environ.get("PORT", 5000)) app.run(h...
""" Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os import random import requests from flask import Flask import tweepy import settings app = Flask(__name__) @app.route('/') def home_page(): return 'Hello from the SPARK learn-a-thon!' def get_instagram_im...
Make functions that pull a number of tweets and pics
Make functions that pull a number of tweets and pics
Python
apache-2.0
samanehsan/spark_github,samanehsan/spark_github,samanehsan/learn-git,samanehsan/learn-git
d9189f91370abd1e20e5010bb70d9c47efd58215
muver/reference.py
muver/reference.py
from wrappers import bowtie2, picard, samtools def create_reference_indices(ref_fn): ''' For a given reference FASTA file, generate several indices. ''' bowtie2.build(ref_fn) samtools.faidx_index(ref_fn) picard.create_sequence_dictionary(ref_fn) def read_chrom_sizes(reference_ass...
import os from wrappers import bowtie2, picard, samtools def create_reference_indices(ref_fn): ''' For a given reference FASTA file, generate several indices. ''' bowtie2.build(ref_fn) samtools.faidx_index(ref_fn) picard.create_sequence_dictionary(ref_fn) def read_chrom_sizes(...
Change read_chrom_sizes to read from a FAIDX index if available
Change read_chrom_sizes to read from a FAIDX index if available
Python
mit
NIEHS/muver
4657acf6408b2fb416e2c9577ac09d18d81f8a68
nameless/config.py
nameless/config.py
import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings DATABASE_NAMES = ['atc', 'nhs', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_basedir, 'db/atc.db'), 'nhs': 'sqlite:///' + os.path.join(_basedir, '...
import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings DATABASE_NAMES = ['atc', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_basedir, 'db/atc.db'), 'sms': 'sqlite:///' + os.path.join(_basedir, 'db/sms....
Remove unused NHS database mockup
Remove unused NHS database mockup
Python
mit
jawrainey/sris
d60dea7b7b1fb073eef2c350177b3920f32de748
6/e6.py
6/e6.py
#!/usr/bin/env python def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 def sum_seq(n): return (n * (n + 1)) / 2 def main(): sum_seq_sq_100 = sum_seq_squares(100) sum_seq_100 = sum_seq(100) sq_sum_seq_100 = sum_seq_100**2 diff = sq_sum_seq_100 - sum_seq_sq_100 print('diff is {0}'.format(diff)) ...
#!/usr/bin/env python # http://www.proofwiki.org/wiki/Sum_of_Sequence_of_Squares def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 # http://www.regentsprep.org/regents/math/algtrig/ATP2/ArithSeq.htm def sum_seq(n): return (n * (n + 1)) / 2 def main(): sum_seq_sq_100 = sum_seq_squares(100) sum_seq_...
Add comments indicating source of formulae..
Add comments indicating source of formulae..
Python
mit
cveazey/ProjectEuler,cveazey/ProjectEuler
e62db9661295ff3912dbaaaff0d9f267f0b7ffe1
auth.py
auth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from bottle.ext import auth from utils import conf try: auth_import = conf('auth')['engine'].split('.')[-1] auth_from = u".".join(conf('auth')['engine'].split('.')[:-1]) auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from bottle.ext import auth from utils import conf try: auth_import = conf('auth')['engine'].split('.')[-1] auth_from = u".".join(conf('auth')['engine'].split('.')[:-1]) auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]), ...
Add url callback on custom login
Add url callback on custom login
Python
mit
AndrzejR/mining,mining/mining,mlgruby/mining,mining/mining,mlgruby/mining,mlgruby/mining,jgabriellima/mining,avelino/mining,jgabriellima/mining,seagoat/mining,chrisdamba/mining,seagoat/mining,avelino/mining,AndrzejR/mining,chrisdamba/mining
8157af3da0e535074b18c76f0e5391d8cac806e8
whats_fresh/whats_fresh_api/tests/views/test_stories.py
whats_fresh/whats_fresh_api/tests/views/test_stories.py
from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class StoriesTestCase(TestCase): fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def s...
from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class StoriesTestCase(TestCase): fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def s...
Add error field to expected JSON
Add error field to expected JSON
Python
apache-2.0
osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api
f2139cad673ee50f027164bda80d86979d5ce7a0
passenger_wsgi.py
passenger_wsgi.py
import os import sys try: from flask import Flask, render_template, send_file, Response import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: try: os.execl(INTERP, INTERP, *sys.argv) except OSError: ...
import os import sys try: from flask import Flask import flask_login from flask_restless import APIManager from flask_sqlalchemy import SQLAlchemy import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: try: ...
Add more imports for further functionality
Add more imports for further functionality `flask_login`, `flask_restless`, `flask_sqlalchemy`
Python
mit
GregBrimble/boilerplate-web-service,GregBrimble/boilerplate-web-service
abae242bbcdc3eefcd0ab1ff29f660f89d47db1a
mirigata/surprise/models.py
mirigata/surprise/models.py
from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000)
from django.core.urlresolvers import reverse from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000) def get_absolute_url(self): return reverse('surprise-detail', kwargs={"pk": self.id})
Add absolute URL for Surprises
Add absolute URL for Surprises This allows the CreateView to work correctly
Python
agpl-3.0
mirigata/mirigata,mirigata/mirigata,mirigata/mirigata,mirigata/mirigata
8b944f04ebf9b635029182a3137e9368edafe9d2
pgsearch/utils.py
pgsearch/utils.py
from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery import shlex import string def parseSearchString(search_string): search_strings = shlex.split(search_string) translator = str.maketrans({key: None for key in string.punctuation}) search_strings = [s.translate(translator) for ...
from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery import shlex import string def parseSearchString(search_string): try: search_strings = shlex.split(search_string) translator = str.maketrans({key: None for key in string.punctuation}) search_strings = [s.trans...
Handle exception for bad search strings
Handle exception for bad search strings
Python
bsd-3-clause
groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu
b077df615eb4354f416877cc2857fb9848e158eb
saleor/core/templatetags/shop.py
saleor/core/templatetags/shop.py
from __future__ import unicode_literals try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from django.template import Library from django.utils.http import urlencode register = Library() @register.filter def slice(items, group_size=1): args = [...
from __future__ import unicode_literals try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from django.template import Library from django.utils.http import urlencode register = Library() @register.filter def slice(items, group_size=1): args = [...
Fix get_sort_by_toggle to work with QueryDicts with multiple values
Fix get_sort_by_toggle to work with QueryDicts with multiple values
Python
bsd-3-clause
UITools/saleor,mociepka/saleor,mociepka/saleor,UITools/saleor,maferelo/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor
7842919b2af368c640363b4e4e05144049b111ba
ovp_core/emails.py
ovp_core/emails.py
from django.core.mail import EmailMultiAlternatives from django.template import Context, Template from django.template.loader import get_template from django.conf import settings import threading class EmailThread(threading.Thread): def __init__(self, msg): self.msg = msg threading.Thread.__init__(sel...
from django.core.mail import EmailMultiAlternatives from django.template import Context, Template from django.template.loader import get_template from django.conf import settings import threading class EmailThread(threading.Thread): def __init__(self, msg): self.msg = msg threading.Thread.__init__(sel...
Remove BaseMail dependency on User object
Remove BaseMail dependency on User object
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core
2652919c8d2e6fad8f7b3d47f5e82528b4b5214e
plots/monotone.py
plots/monotone.py
# MONOTONE # Produce a monotonically decreasing output plot from noisy data # Input: columns: t x # Output: columns: t_i x_i , sampled such that x_i <= x_j # for j > i. from string import * import sys # Set PYTHONPATH=$PWD from plottools import * if len(sys.argv) != 3: abort("usage:...
# MONOTONE # Produce a monotonically decreasing output plot from noisy data # Input: columns: t x # Output: columns: t_i x_i , sampled such that x_i <= x_j # for j > i. from string import * import sys # Set PYTHONPATH=$PWD from plottools import * if len(sys.argv) != 3: abort("usage:...
Write the last point for plot completeness
Write the last point for plot completeness
Python
mit
ECP-CANDLE/Database,ECP-CANDLE/Database
08b54819a56d9bfc65225045d97a4c331f9a3e11
manage.py
manage.py
#!/usr/bin/env python3 from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from service import app, db # db.create_all() needs all models to be imported from service.db_access import * migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) if _...
#!/usr/bin/env python3 from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from service import app, db # db.create_all() needs all models to be imported explicitly (not *) from service.db_access import User migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', ...
Fix model import needed by create_all()
Fix model import needed by create_all()
Python
mit
LandRegistry/login-api,LandRegistry/login-api
a3ad91928f7d4753204a2443237c7f720fed37f1
inselect/gui/sort_document_items.py
inselect/gui/sort_document_items.py
from PySide.QtCore import QSettings from inselect.lib.sort_document_items import sort_document_items # QSettings path _PATH = 'sort_by_columns' # Global - set to instance of CookieCutterChoice in cookie_cutter_boxes _SORT_DOCUMENT = None def sort_items_choice(): "Returns an instance of SortDocumentItems" g...
from PySide.QtCore import QSettings from inselect.lib.sort_document_items import sort_document_items # QSettings path _PATH = 'sort_by_columns' # Global - set to instance of CookieCutterChoice in cookie_cutter_boxes _SORT_DOCUMENT = None def sort_items_choice(): "Returns an instance of SortDocumentItems" g...
Fix persistence of 'sort by' preference on Windows
Fix persistence of 'sort by' preference on Windows
Python
bsd-3-clause
NaturalHistoryMuseum/inselect,NaturalHistoryMuseum/inselect
783f7a5d17b3db83e1f27ad3bebb4c165c4e66ca
django_settings/keymaker.py
django_settings/keymaker.py
class KeyMaker(object): def __init__(self, prefix): self.prefix = prefix def convert(self, arg): return str(arg) def args_to_key(self, args): return ":".join(map(self.convert, args)) def kwargs_to_key(self, kwargs): return ":".join([ "%s:%s" % (self.convert...
import sys class KeyMaker(object): def __init__(self, prefix): self.prefix = prefix def convert(self, arg): if sys.version_info < (3,) and isinstance(arg, unicode): return arg.encode(django.settings.DEFAULT_CHARSET) return str(arg) def args_to_key(self, args): ...
Fix convert to support python 2 and python 3
Fix convert to support python 2 and python 3
Python
bsd-3-clause
jrutila/django-settings,jrutila/django-settings,jrutila/django-settings,jrutila/django-settings
f8eb93f1845a7776c61a59bafc6fdeb689712aff
examples/comp/ask_user_dialog.py
examples/comp/ask_user_dialog.py
"""Example showing the Ask User dialog controls and overall usage.""" import fusionless as fu dialog = fu.AskUserDialog() dialog.add_text("text", default="Default text value") dialog.add_position("position", default=(0.2, 0.8)) dialog.add_slider("slider", default=0.5, min=-10, max=10) dialog.add_screw("screw") dialog...
"""Example showing the Ask User dialog controls and overall usage.""" import fusionless as fu dialog = fu.AskUserDialog("Example Ask User Dialog") dialog.add_text("text", default="Default text value") dialog.add_position("position", default=(0.2, 0.8)) dialog.add_slider("slider", default=0.5, min=-10, max=10) dialog....
Add dialog title to example
Add dialog title to example
Python
bsd-3-clause
BigRoy/fusionless,BigRoy/fusionscript
818d89c897603eeb33caf1ca2cdaeae5c3010880
engines/mako_engine.py
engines/mako_engine.py
#!/usr/bin/env python """Provide the mako templating engine.""" from __future__ import print_function from mako.template import Template from mako.lookup import TemplateLookup from . import Engine class MakoEngine(Engine): """Mako templating engine.""" handle = 'mako' def __init__(self, template, t...
#!/usr/bin/env python """Provide the mako templating engine.""" from __future__ import print_function from mako.template import Template from mako.lookup import TemplateLookup from . import Engine class MakoEngine(Engine): """Mako templating engine.""" handle = 'mako' def __init__(self, template, d...
Use passed directory in mako engine.
Use passed directory in mako engine.
Python
mit
blubberdiblub/eztemplate
04c3cac3054626773bc0434453378cb295f7e38c
pytus2000/read.py
pytus2000/read.py
import pandas as pd from .datadicts import diary def read_diary_file(path_to_file): return pd.read_csv( path_to_file, delimiter='\t', nrows=50, converters=_column_name_to_type_mapping(diary), low_memory=False # some columns seem to have mixed types ) def _column_name...
import pandas as pd from .datadicts import diary def read_diary_file(path_to_file): return pd.read_csv( path_to_file, delimiter='\t', converters=_column_name_to_type_mapping(diary), low_memory=False # some columns seem to have mixed types ) def _column_name_to_type_mapping(m...
Add handling of invalid values
Add handling of invalid values Values that are not defined in the data dictionary will be replaced by None.
Python
mit
timtroendle/pytus2000
826f23f0fc7eea4c72dcc26f637f3752bee51b47
test/ctypesgentest.py
test/ctypesgentest.py
import optparse, sys, StringIO sys.path.append("..") import ctypesgencore """ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a single function, test(). test() takes a string that represents a C header file, along with some keyword arguments representing options. It proces...
import optparse, sys, StringIO sys.path.append(".") # Allow tests to be called from parent directory with Python 2.6 sys.path.append("..") import ctypesgencore """ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a single function, test(). test() takes a string that repres...
Allow tests to be called from parent directory of "test"
Allow tests to be called from parent directory of "test" git-svn-id: 397be6d5b34b040010577acc149a81bea378be26@89 1754e6c4-832e-0410-bb55-0fb906f63d99
Python
bsd-3-clause
kanzure/ctypesgen,kanzure/ctypesgen,novas0x2a/ctypesgen,davidjamesca/ctypesgen,kanzure/ctypesgen
69eafa95df4bdeb143d40c321f0a312d06efff1f
skimage/segmentation/__init__.py
skimage/segmentation/__init__.py
from .random_walker_segmentation import random_walker from ._felzenszwalb import felzenszwalb from ._slic import slic from ._quickshift import quickshift from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries from ._clear_border import clear_border from ._join import join_segmentations, relabel_...
from .random_walker_segmentation import random_walker from ._felzenszwalb import felzenszwalb from ._slic import slic from ._quickshift import quickshift from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries from ._clear_border import clear_border from ._join import join_segmentations, relabel_...
Add __all__ to segmentation package
Add __all__ to segmentation package
Python
bsd-3-clause
Midafi/scikit-image,pratapvardhan/scikit-image,michaelaye/scikit-image,bsipocz/scikit-image,blink1073/scikit-image,robintw/scikit-image,oew1v07/scikit-image,Britefury/scikit-image,chriscrosscutler/scikit-image,Hiyorimi/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,newville/scikit-image,ajaybhat/scikit-...