commit stringlengths 40 40 | old_file stringlengths 5 117 | new_file stringlengths 5 117 | old_contents stringlengths 0 1.93k | new_contents stringlengths 19 3.3k | subject stringlengths 17 320 | message stringlengths 18 3.28k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 7 42.4k | completion stringlengths 19 3.3k | prompt stringlengths 21 3.65k |
|---|---|---|---|---|---|---|---|---|---|---|---|
c6265c2112ee9985af8b6b80fe0bee1811dc6abd | setup.py | setup.py | # -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='oceanoptics',
version='0.2.6',
author='Andreas Poehlmann, Jose A. Jimenez-Berni, Ben Gamari, Simon Dickreuter',
author_email='mail@andreaspoehlmann.de',
packages=['oceanoptics', 'oceanoptics.spectrometers'],
description='A Py... | # -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='oceanoptics',
version='0.2.7',
author='Andreas Poehlmann, Jose A. Jimenez-Berni, Ben Gamari, Simon Dickreuter, Ian Ross Williams',
author_email='mail@andreaspoehlmann.de',
packages=['oceanoptics', 'oceanoptics.spectrometers'],
... | Add author and increase version number | Add author and increase version number
| Python | mit | ap--/python-oceanoptics | # -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='oceanoptics',
version='0.2.7',
author='Andreas Poehlmann, Jose A. Jimenez-Berni, Ben Gamari, Simon Dickreuter, Ian Ross Williams',
author_email='mail@andreaspoehlmann.de',
packages=['oceanoptics', 'oceanoptics.spectrometers'],
... | Add author and increase version number
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='oceanoptics',
version='0.2.6',
author='Andreas Poehlmann, Jose A. Jimenez-Berni, Ben Gamari, Simon Dickreuter',
author_email='mail@andreaspoehlmann.de',
packages=['oceanoptics', 'oceanoptic... |
0ec5aeca33676172f458ec6761282157dcb19635 | tests/test_set_pref.py | tests/test_set_pref.py | # tests.test_set_pref
import nose.tools as nose
import yvs.set_pref as yvs
def test_set_language():
"""should set preferred language"""
new_language = 'es'
yvs.main('language:{}'.format(new_language))
user_prefs = yvs.shared.get_user_prefs()
nose.assert_equal(user_prefs['language'], new_language)... | # tests.test_set_pref
import nose.tools as nose
import yvs.set_pref as yvs
def test_set_language():
"""should set preferred language"""
new_language = 'es'
yvs.main('language:{}'.format(new_language))
user_prefs = yvs.shared.get_user_prefs()
nose.assert_equal(user_prefs['language'], new_language)... | Add test for setting preferred search engine | Add test for setting preferred search engine
| Python | mit | caleb531/youversion-suggest,caleb531/youversion-suggest | # tests.test_set_pref
import nose.tools as nose
import yvs.set_pref as yvs
def test_set_language():
"""should set preferred language"""
new_language = 'es'
yvs.main('language:{}'.format(new_language))
user_prefs = yvs.shared.get_user_prefs()
nose.assert_equal(user_prefs['language'], new_language)... | Add test for setting preferred search engine
# tests.test_set_pref
import nose.tools as nose
import yvs.set_pref as yvs
def test_set_language():
"""should set preferred language"""
new_language = 'es'
yvs.main('language:{}'.format(new_language))
user_prefs = yvs.shared.get_user_prefs()
nose.asse... |
b191a78d847167616dc38756c9fb450e5eb95c70 | utils/database.py | utils/database.py | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... | Add new-line at EOF, when dumping userdb | Add new-line at EOF, when dumping userdb
| Python | mit | wolfy1339/Python-IRC-Bot | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... | Add new-line at EOF, when dumping userdb
import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event... |
0d6a8f3978188f3e343c364806e0bb6e6ac1e643 | tests/qtcore/qmetaobject_test.py | tests/qtcore/qmetaobject_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''Tests for static methos conflicts with class methods'''
import unittest
from PySide.QtCore import *
class Foo(QFile):
pass
class qmetaobject_test(unittest.TestCase):
def test_QMetaObject(self):
qobj = QObject()
qobj_metaobj = qobj.metaObject()
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''Tests for static methos conflicts with class methods'''
import unittest
from PySide.QtCore import *
class Foo(QFile):
pass
class qmetaobject_test(unittest.TestCase):
def test_QMetaObject(self):
qobj = QObject()
qobj_metaobj = qobj.metaObject()
... | Fix qmentaobject test to work with dynamic metaobject. | Fix qmentaobject test to work with dynamic metaobject.
| Python | lgpl-2.1 | M4rtinK/pyside-android,pankajp/pyside,enthought/pyside,PySide/PySide,qtproject/pyside-pyside,PySide/PySide,gbaty/pyside2,enthought/pyside,RobinD42/pyside,enthought/pyside,PySide/PySide,BadSingleton/pyside2,M4rtinK/pyside-android,BadSingleton/pyside2,qtproject/pyside-pyside,BadSingleton/pyside2,RobinD42/pyside,pankajp/p... | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''Tests for static methos conflicts with class methods'''
import unittest
from PySide.QtCore import *
class Foo(QFile):
pass
class qmetaobject_test(unittest.TestCase):
def test_QMetaObject(self):
qobj = QObject()
qobj_metaobj = qobj.metaObject()
... | Fix qmentaobject test to work with dynamic metaobject.
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''Tests for static methos conflicts with class methods'''
import unittest
from PySide.QtCore import *
class Foo(QFile):
pass
class qmetaobject_test(unittest.TestCase):
def test_QMetaObject(self):
qobj = ... |
a9ac098ec492739f37005c9bd6278105df0261c5 | parliamentsearch/items.py | parliamentsearch/items.py | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class MemberofParliament(scrapy.Item):
"""
Data structure to define Member of Parliament information
"""
mp_id = scrapy.Field()
mp_name = scrapy.F... | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class MemberofParliament(scrapy.Item):
"""
Data structure to define Member of Parliament information
"""
mp_id = scrapy.Field()
mp_name = scrapy.F... | Add fields to save question url and annexure links | Add fields to save question url and annexure links
Details of each question is in another link and some questions have annexures
(in English/Hindi), add fields to save all these items
Signed-off-by: Arun Siluvery <66692e34e783869a1e5829b4c5eee5e1a471c4f7@gmail.com>
| Python | mit | mthipparthi/parliament-search | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class MemberofParliament(scrapy.Item):
"""
Data structure to define Member of Parliament information
"""
mp_id = scrapy.Field()
mp_name = scrapy.F... | Add fields to save question url and annexure links
Details of each question is in another link and some questions have annexures
(in English/Hindi), add fields to save all these items
Signed-off-by: Arun Siluvery <66692e34e783869a1e5829b4c5eee5e1a471c4f7@gmail.com>
# -*- coding: utf-8 -*-
# Define here the models f... |
6e6fed456ff9c641292933f87c99af8be6823e3f | src/main.py | src/main.py | from rules import ascii_code_rule
import utils
import pprint
import bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.customization import homogeneize_latex_encoding
DEFAULT = 'default'
pp = pprint.PrettyPrinter()
def main(file_name, output='default'):
with open(file_name) as bibtex_fil... | from rules import ascii_code_rule, no_short_title_rule, enforce_year_rule, no_super_long_title_rule
import utils
import pprint
import bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.customization import homogeneize_latex_encoding
DEFAULT = 'default'
SCHEMAS = {
'ASCII_CODE_RULE': ascii... | Implement filter based on user input | Implement filter based on user input
| Python | mit | DanielCMS/bibtex-cleaner | from rules import ascii_code_rule, no_short_title_rule, enforce_year_rule, no_super_long_title_rule
import utils
import pprint
import bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.customization import homogeneize_latex_encoding
DEFAULT = 'default'
SCHEMAS = {
'ASCII_CODE_RULE': ascii... | Implement filter based on user input
from rules import ascii_code_rule
import utils
import pprint
import bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.customization import homogeneize_latex_encoding
DEFAULT = 'default'
pp = pprint.PrettyPrinter()
def main(file_name, output='default'):
... |
caaa5d9030dacacdc940bc2750a98eaabb82d0a7 | src/engine/request_handler.py | src/engine/request_handler.py | import Queue
import json
import EBQP
from . import world
from . import types
from . import consts
class GameRequestHandler:
def __init__(self):
self.world = None
self.responses = {
EBQP.new: self.respond_new,
}
def process(self, request):
request_pieces = request... | import Queue
import json
import EBQP
from . import world
from . import types
from . import consts
class GameRequestHandler:
def __init__(self):
self.world = None
self.responses = {
EBQP.new: self.respond_new,
}
def process(self, request):
request_pieces = request... | Fix crash on game creation | Fix crash on game creation
| Python | mit | Tactique/game_engine,Tactique/game_engine | import Queue
import json
import EBQP
from . import world
from . import types
from . import consts
class GameRequestHandler:
def __init__(self):
self.world = None
self.responses = {
EBQP.new: self.respond_new,
}
def process(self, request):
request_pieces = request... | Fix crash on game creation
import Queue
import json
import EBQP
from . import world
from . import types
from . import consts
class GameRequestHandler:
def __init__(self):
self.world = None
self.responses = {
EBQP.new: self.respond_new,
}
def process(self, request):
... |
e72b6272469c382f14a6732514777aacbd457322 | rest_framework_json_api/exceptions.py | rest_framework_json_api/exceptions.py | from django.utils import encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.views import exception_handler as drf_exception_handler
from rest_framework_json_api.utils import format_value
def excepti... | from django.utils import encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.views import exception_handler as drf_exception_handler
from rest_framework_json_api.utils import format_value
def excepti... | Fix for some error messages that were split into several messages | Fix for some error messages that were split into several messages
The exception handler expects the error to be a list on line 33. In my
case they were a string, which lead to the split of the string into
multiple errors containing one character
| Python | bsd-2-clause | django-json-api/rest_framework_ember,Instawork/django-rest-framework-json-api,leifurhauks/django-rest-framework-json-api,hnakamur/django-rest-framework-json-api,martinmaillard/django-rest-framework-json-api,pombredanne/django-rest-framework-json-api,lukaslundgren/django-rest-framework-json-api,leo-naeka/rest_framework_... | from django.utils import encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.views import exception_handler as drf_exception_handler
from rest_framework_json_api.utils import format_value
def excepti... | Fix for some error messages that were split into several messages
The exception handler expects the error to be a list on line 33. In my
case they were a string, which lead to the split of the string into
multiple errors containing one character
from django.utils import encoding
from django.utils.translation import u... |
853dc6b254c66807fd6c44b374c89b90069f55b5 | Lib/test/test_startfile.py | Lib/test/test_startfile.py | # Ridiculously simple test of the os.startfile function for Windows.
#
# empty.vbs is an empty file (except for a comment), which does
# nothing when run with cscript or wscript.
#
# A possible improvement would be to have empty.vbs do something that
# we can detect here, to make sure that not only the os.startfile()
#... | # Ridiculously simple test of the os.startfile function for Windows.
#
# empty.vbs is an empty file (except for a comment), which does
# nothing when run with cscript or wscript.
#
# A possible improvement would be to have empty.vbs do something that
# we can detect here, to make sure that not only the os.startfile()
#... | Change the import statement so that the test is skipped when os.startfile is not present. | Change the import statement so that the test is skipped when
os.startfile is not present.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | # Ridiculously simple test of the os.startfile function for Windows.
#
# empty.vbs is an empty file (except for a comment), which does
# nothing when run with cscript or wscript.
#
# A possible improvement would be to have empty.vbs do something that
# we can detect here, to make sure that not only the os.startfile()
#... | Change the import statement so that the test is skipped when
os.startfile is not present.
# Ridiculously simple test of the os.startfile function for Windows.
#
# empty.vbs is an empty file (except for a comment), which does
# nothing when run with cscript or wscript.
#
# A possible improvement would be to have empty.... |
2a8f064733892b86c2041f3294d5efebd4b565d9 | txircd/modules/extra/channelopaccess.py | txircd/modules/extra/channelopaccess.py | from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class ChannelOpAccess(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "ChannelOpAccess"
affectedActions = {
"check... | Allow channel ops to change the required level for specific permissions | Allow channel ops to change the required level for specific permissions
| Python | bsd-3-clause | Heufneutje/txircd,ElementalAlchemist/txircd | from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class ChannelOpAccess(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "ChannelOpAccess"
affectedActions = {
"check... | Allow channel ops to change the required level for specific permissions
| |
486978630261bddf1bccdb7f1817c6aa26f78c57 | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
# Standard Libs
import datetime
import os
import sys
# Add flask_hal to the Path
root = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..',
)
)
sys.path.append(os.path.join(root, 'flask_hal'))
# First Party Libs
import flask_hal # noqa
# Project details
... | # -*- coding: utf-8 -*-
# Standard Libs
import datetime
import os
import sys
# Add flask_hal to the Path
root = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..',
)
)
sys.path.append(os.path.join(root, 'flask_hal'))
# First Party Libs
import flask_hal # noqa
# Project details
... | Load version from version file | Load version from version file
| Python | unlicense | thisissoon/Flask-HAL,thisissoon/Flask-HAL | # -*- coding: utf-8 -*-
# Standard Libs
import datetime
import os
import sys
# Add flask_hal to the Path
root = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..',
)
)
sys.path.append(os.path.join(root, 'flask_hal'))
# First Party Libs
import flask_hal # noqa
# Project details
... | Load version from version file
# -*- coding: utf-8 -*-
# Standard Libs
import datetime
import os
import sys
# Add flask_hal to the Path
root = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..',
)
)
sys.path.append(os.path.join(root, 'flask_hal'))
# First Party Libs
import flask... |
26934dae71cb006baf0dcf77ddec4938b8c4fdbd | pinry/settings/docker.py | pinry/settings/docker.py | import logging
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
if 'SECRET_KEY' not in os.environ:
logging.warning(
"No SECRET_KEY given in environ, please have a check"
)
SECRET_KEY = os.environ.get('SECRET_KEY', "PLEASE_REPLACE_ME")
# SECURITY WARNING: don't r... | import logging
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
if 'SECRET_KEY' not in os.environ:
logging.warning(
"No SECRET_KEY given in environ, please have a check."
"If you have a local_settings file, please ignore this warning."
)
SECRET_KEY = os.e... | Add ignore info for secret-key env-test | Doc: Add ignore info for secret-key env-test
| Python | bsd-2-clause | lapo-luchini/pinry,pinry/pinry,pinry/pinry,lapo-luchini/pinry,lapo-luchini/pinry,pinry/pinry,lapo-luchini/pinry,pinry/pinry | import logging
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
if 'SECRET_KEY' not in os.environ:
logging.warning(
"No SECRET_KEY given in environ, please have a check."
"If you have a local_settings file, please ignore this warning."
)
SECRET_KEY = os.e... | Doc: Add ignore info for secret-key env-test
import logging
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
if 'SECRET_KEY' not in os.environ:
logging.warning(
"No SECRET_KEY given in environ, please have a check"
)
SECRET_KEY = os.environ.get('SECRET_KEY', "PL... |
55a4680bb07896f0bab06d836ade056d115f004f | dsub/_dsub_version.py | dsub/_dsub_version.py | # Copyright 2017 Google Inc. 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 applicable law or a... | # Copyright 2017 Google Inc. 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 applicable law or a... | Update version number to 0.1.10.dev0. | Update version number to 0.1.10.dev0.
PiperOrigin-RevId: 202663603
| Python | apache-2.0 | DataBiosphere/dsub,DataBiosphere/dsub | # Copyright 2017 Google Inc. 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 applicable law or a... | Update version number to 0.1.10.dev0.
PiperOrigin-RevId: 202663603
# Copyright 2017 Google Inc. 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.apach... |
d560a809c4d0fd78e1ce0454ea5406e81f356906 | server_app/__main__.py | server_app/__main__.py | import sys
import os
import logging
if not os.path.exists(os.path.expanduser("~/.chatserver")):
os.makedirs(os.path.expanduser("~/.chatserver"))
logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat.log"), level=logging.DEBUG)
sys.stderr.close()
sys.stdout.close()
sys.stdin.close()
from app import ... | import sys
import os
import logging
import time
if not os.path.exists(os.path.expanduser("~/.chatserver")):
os.makedirs(os.path.expanduser("~/.chatserver"))
logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat-"+time.strftime("%d-%m-%Y.log"), level=logging.DEBUG)
sys.stderr.close()
sys.stdout.close... | Make logger sort by date | Make logger sort by date
| Python | bsd-3-clause | jos0003/Chat,jos0003/Chat,jos0003/Chat,jos0003/Chat,jos0003/Chat | import sys
import os
import logging
import time
if not os.path.exists(os.path.expanduser("~/.chatserver")):
os.makedirs(os.path.expanduser("~/.chatserver"))
logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat-"+time.strftime("%d-%m-%Y.log"), level=logging.DEBUG)
sys.stderr.close()
sys.stdout.close... | Make logger sort by date
import sys
import os
import logging
if not os.path.exists(os.path.expanduser("~/.chatserver")):
os.makedirs(os.path.expanduser("~/.chatserver"))
logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat.log"), level=logging.DEBUG)
sys.stderr.close()
sys.stdout.close()
sys.stdin... |
6b59d17aa06741f40bb99dde6c10950de3a142e6 | utils/load.py | utils/load.py | #!/usr/local/bin/python
from website import carts
import urllib2
import json
def load():
carts.remove_all()
host = 'http://data.cityofnewyork.us/resource/xfyi-uyt5.json'
for i in range(0, 7000, 1000):
query = 'permit_type_description=MOBILE+FOOD+UNIT&$offset=%d' % i
request = host + '?' +... | #!/usr/local/bin/python
from website import carts
import urllib2
import json
def load():
carts.remove_all()
request = 'http://data.cityofnewyork.us/resource/akqf-qv4n.json'
for i in range(0, 24000, 1000):
query = '?$offset=%d' % i
data = urllib2.urlopen(request + query)
results =... | Change cart structure and url endpoint for getting cart data | Change cart structure and url endpoint for getting cart data
| Python | bsd-3-clause | stuycs-softdev-fall-2013/proj3-7-cartwheels,stuycs-softdev-fall-2013/proj3-7-cartwheels | #!/usr/local/bin/python
from website import carts
import urllib2
import json
def load():
carts.remove_all()
request = 'http://data.cityofnewyork.us/resource/akqf-qv4n.json'
for i in range(0, 24000, 1000):
query = '?$offset=%d' % i
data = urllib2.urlopen(request + query)
results =... | Change cart structure and url endpoint for getting cart data
#!/usr/local/bin/python
from website import carts
import urllib2
import json
def load():
carts.remove_all()
host = 'http://data.cityofnewyork.us/resource/xfyi-uyt5.json'
for i in range(0, 7000, 1000):
query = 'permit_type_description=M... |
391e145b6e82aaa87e2ab23cfea53cb7ae98bc2a | tlsenum/parse_hello.py | tlsenum/parse_hello.py | import construct
from tlsenum import hello_constructs
class ClientHello(object):
@property
def protocol_version(self):
return self._protocol_version
@protocol_version.setter
def protocol_version(self, protocol_version):
assert protocol_version in ["3.0", "1.0", "1.1", "1.2"]
... | Add a work-in-progress parser for the ClientHello message. | Add a work-in-progress parser for the ClientHello message.
| Python | mit | Ayrx/tlsenum,Ayrx/tlsenum | import construct
from tlsenum import hello_constructs
class ClientHello(object):
@property
def protocol_version(self):
return self._protocol_version
@protocol_version.setter
def protocol_version(self, protocol_version):
assert protocol_version in ["3.0", "1.0", "1.1", "1.2"]
... | Add a work-in-progress parser for the ClientHello message.
| |
a014cd2184d4c9634c02d1cac9d1fd41fb3c6c37 | eduid_IdP_html/tests/test_translation.py | eduid_IdP_html/tests/test_translation.py | from unittest import TestCase
import eduid_IdP_html
__author__ = 'ft'
class TestLoad_settings(TestCase):
def test_load_settings(self):
settings = eduid_IdP_html.load_settings()
self.assertTrue(settings['gettext_domain'] is not None) | from unittest import TestCase
import eduid_IdP_html
__author__ = 'ft'
class TestLoad_settings(TestCase):
def test_load_settings(self):
settings = eduid_IdP_html.load_settings()
self.assertTrue(settings['gettext_domain'] is not None)
| Add newline at end of file. | Add newline at end of file.
| Python | bsd-3-clause | SUNET/eduid-IdP-html,SUNET/eduid-IdP-html,SUNET/eduid-IdP-html | from unittest import TestCase
import eduid_IdP_html
__author__ = 'ft'
class TestLoad_settings(TestCase):
def test_load_settings(self):
settings = eduid_IdP_html.load_settings()
self.assertTrue(settings['gettext_domain'] is not None)
| Add newline at end of file.
from unittest import TestCase
import eduid_IdP_html
__author__ = 'ft'
class TestLoad_settings(TestCase):
def test_load_settings(self):
settings = eduid_IdP_html.load_settings()
self.assertTrue(settings['gettext_domain'] is not None) |
02ac5dcfa6bdaf9b8152ef2f49fd61afe9faf8ab | client/python/plot_request_times.py | client/python/plot_request_times.py | import requests
from plotly.offline import plot
import plotly.graph_objs as go
r = requests.get('http://localhost:8081/monitor_results/1')
print(r.json())
# build traces for plotting from monitoring data
request_times = list()
timestamps = list()
timestamp = 0
url = r.json()[0]['urlToMonitor']['url']
for monitoring_d... | import requests
from plotly.offline import plot
import plotly.graph_objs as go
def build_data_for_monitored_url(id):
'''Fetches and prepares data for plotting for the given URL id'''
r = requests.get('http://localhost:8081/monitor_results/' + str(id))
# build traces for plotting from monitoring data
re... | Implement fetching all monitored data | Implement fetching all monitored data
| Python | mit | gernd/simple-site-mon | import requests
from plotly.offline import plot
import plotly.graph_objs as go
def build_data_for_monitored_url(id):
'''Fetches and prepares data for plotting for the given URL id'''
r = requests.get('http://localhost:8081/monitor_results/' + str(id))
# build traces for plotting from monitoring data
re... | Implement fetching all monitored data
import requests
from plotly.offline import plot
import plotly.graph_objs as go
r = requests.get('http://localhost:8081/monitor_results/1')
print(r.json())
# build traces for plotting from monitoring data
request_times = list()
timestamps = list()
timestamp = 0
url = r.json()[0][... |
a9f40d7549c43e3e7faf90c79f19a290761d2e08 | src/tests/ggrc/__init__.py | src/tests/ggrc/__init__.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
from flask.ext.testing import TestCase as BaseTestCase
from ggrc import db
fro... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
from flask.ext.testing import TestCase as BaseTestCase
from ggrc import db
fro... | Allow Google AppEngine Memcache stub to be used for running unit tests including calls to caching layer | Allow Google AppEngine Memcache stub to be used for running unit tests including calls to caching layer
| Python | apache-2.0 | hyperNURb/ggrc-core,prasannav7/ggrc-core,vladan-m/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,uskudnik/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,NejcZupec/ggrc-core,p... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
from flask.ext.testing import TestCase as BaseTestCase
from ggrc import db
fro... | Allow Google AppEngine Memcache stub to be used for running unit tests including calls to caching layer
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: ... |
edcce0e44c453f459e82774efeb0996457d84306 | integration_tests/tests/test_experiment_detumbling.py | integration_tests/tests/test_experiment_detumbling.py | from datetime import timedelta, datetime
import telecommand
from obc.experiments import ExperimentType
from system import auto_power_on
from tests.base import BaseTest
from utils import TestEvent
class TestExperimentDetumbling(BaseTest):
@auto_power_on(auto_power_on=False)
def __init__(self, *args... | from datetime import timedelta, datetime
import telecommand
from obc.experiments import ExperimentType
from system import auto_power_on
from tests.base import BaseTest
from utils import TestEvent
class TestExperimentDetumbling(BaseTest):
@auto_power_on(auto_power_on=False)
def __init__(self, *args... | Fix race condition in detumbling experiment test | Fix race condition in detumbling experiment test
In detumbling experiment test, experiment was commanded to run for 4
hours. After that OBC time was advanced also by 4 hours, however it was
not enough as during next mission loop OBC time was few milliseconds
before scheduled experiment end.
| Python | agpl-3.0 | PW-Sat2/PWSat2OBC,PW-Sat2/PWSat2OBC,PW-Sat2/PWSat2OBC,PW-Sat2/PWSat2OBC | from datetime import timedelta, datetime
import telecommand
from obc.experiments import ExperimentType
from system import auto_power_on
from tests.base import BaseTest
from utils import TestEvent
class TestExperimentDetumbling(BaseTest):
@auto_power_on(auto_power_on=False)
def __init__(self, *args... | Fix race condition in detumbling experiment test
In detumbling experiment test, experiment was commanded to run for 4
hours. After that OBC time was advanced also by 4 hours, however it was
not enough as during next mission loop OBC time was few milliseconds
before scheduled experiment end.
from datetime import timed... |
69d18539fb4f394ca45d1116a521084c83ea21b5 | icekit_events/migrations/0012_auto_20160706_1606.py | icekit_events/migrations/0012_auto_20160706_1606.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_events', '0011_event_show_in_calendar'),
]
operations = [
migrations.AlterModelTable(
name='event',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_events', '0011_event_show_in_calendar'),
]
operations = [
migrations.AlterModelTable(
name='event',
... | Make migration reverse no-op a valid SQL query | Make migration reverse no-op a valid SQL query
When using a PostgreSQL database with Django 1.7 empty reverse query
statements in DB migrations cause an error, so we replace the empty
no-op statement with a valid query that still does nothing so the
reverse migration will work in this case.
This problem doesn't seem ... | Python | mit | ic-labs/icekit-events,ic-labs/icekit-events,ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_events', '0011_event_show_in_calendar'),
]
operations = [
migrations.AlterModelTable(
name='event',
... | Make migration reverse no-op a valid SQL query
When using a PostgreSQL database with Django 1.7 empty reverse query
statements in DB migrations cause an error, so we replace the empty
no-op statement with a valid query that still does nothing so the
reverse migration will work in this case.
This problem doesn't seem ... |
ea54f0a306c6defa4edc58c50794da0083ed345d | setup_app.py | setup_app.py |
import os
from flask_app.database import init_db
# Generate new secret key
secret_key = os.urandom(24).encode('hex').strip()
with open('flask_app/secret_key.py', 'w') as key_file:
key_file.write('secret_key = """' + secret_key + '""".decode("hex")')
# Initialize database
init_db()
|
import os
from flask_app.database import init_db
# Generate new secret key
key_file_path = 'flask_app/secret_key.py'
if not os.path.isfile(key_file_path):
secret_key = os.urandom(24).encode('hex').strip()
with open(key_file_path, 'w') as key_file:
key_file.write('secret_key = """' + secret_key + '""".... | Check if keyfile exists before generating new key | Check if keyfile exists before generating new key
| Python | mit | szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft |
import os
from flask_app.database import init_db
# Generate new secret key
key_file_path = 'flask_app/secret_key.py'
if not os.path.isfile(key_file_path):
secret_key = os.urandom(24).encode('hex').strip()
with open(key_file_path, 'w') as key_file:
key_file.write('secret_key = """' + secret_key + '""".... | Check if keyfile exists before generating new key
import os
from flask_app.database import init_db
# Generate new secret key
secret_key = os.urandom(24).encode('hex').strip()
with open('flask_app/secret_key.py', 'w') as key_file:
key_file.write('secret_key = """' + secret_key + '""".decode("hex")')
# Initialize... |
8362216a009763d4bf70c55819a74cc98c8e9ffe | _pytest/test_server.py | _pytest/test_server.py | from slackclient._user import User
from slackclient._server import Server, SlackLoginError
from slackclient._channel import Channel
import json
import pytest
@pytest.fixture
def login_data():
login_data = open('_pytest/data/rtm.start.json','r').read()
login_data = json.loads(login_data)
return login_data
... | from slackclient._user import User
from slackclient._server import Server, SlackLoginError
from slackclient._channel import Channel
import json
import pytest
@pytest.fixture
def login_data():
login_data = open('_pytest/data/rtm.start.json', 'r').read()
login_data = json.loads(login_data)
return login_data... | Fix PEP8 white spacing (space after comma) | Fix PEP8 white spacing (space after comma)
| Python | mit | slackhq/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient | from slackclient._user import User
from slackclient._server import Server, SlackLoginError
from slackclient._channel import Channel
import json
import pytest
@pytest.fixture
def login_data():
login_data = open('_pytest/data/rtm.start.json', 'r').read()
login_data = json.loads(login_data)
return login_data... | Fix PEP8 white spacing (space after comma)
from slackclient._user import User
from slackclient._server import Server, SlackLoginError
from slackclient._channel import Channel
import json
import pytest
@pytest.fixture
def login_data():
login_data = open('_pytest/data/rtm.start.json','r').read()
login_data = j... |
edcde8ed3562e19b7bde43632965c2902a8e7f25 | troposphere/sns.py | troposphere/sns.py | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .compat import policytypes
from .validators import boolean
class Subscription(AWSProperty):
props = {
'Endpoint': (basestring, True),
'Proto... | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .compat import policytypes
from .validators import boolean
class Subscription(AWSProperty):
props = {
'Endpoint': (basestring, True),
... | Add Tags to SNS::Topic per 2019-11-31 changes | Add Tags to SNS::Topic per 2019-11-31 changes
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere,ikben/troposphere,ikben/troposphere | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .compat import policytypes
from .validators import boolean
class Subscription(AWSProperty):
props = {
'Endpoint': (basestring, True),
... | Add Tags to SNS::Topic per 2019-11-31 changes
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .compat import policytypes
from .validators import boolean
class Subscription(AWSProperty):
props = {
... |
123f6a34d9d423f380254b70a5013c0df592d4b6 | tests/run_coverage.py | tests/run_coverage.py | #!/usr/bin/env python
"""Script to collect coverage information on ofStateManager"""
import os
import sys
import inspect
import coverage
import subprocess
def main():
"""Main function"""
arguments = ''
if len(sys.argv) > 1:
arguments = ' '.join(sys.argv[1:])
testdir = os.path.abspath(os.path.dirname(
inspec... | #!/usr/bin/env python
"""Script to collect coverage information on ofStateManager"""
import os
import sys
import inspect
import coverage
import subprocess
def main():
"""Main function"""
arguments = ''
if len(sys.argv) > 1:
arguments = ' '.join(sys.argv[1:])
testdir = os.path.abspath(os.path.dirname(
inspec... | Replace coverage API calls by subprocess calls. | Replace coverage API calls by subprocess calls. | Python | mit | bilderbuchi/ofStateManager | #!/usr/bin/env python
"""Script to collect coverage information on ofStateManager"""
import os
import sys
import inspect
import coverage
import subprocess
def main():
"""Main function"""
arguments = ''
if len(sys.argv) > 1:
arguments = ' '.join(sys.argv[1:])
testdir = os.path.abspath(os.path.dirname(
inspec... | Replace coverage API calls by subprocess calls.
#!/usr/bin/env python
"""Script to collect coverage information on ofStateManager"""
import os
import sys
import inspect
import coverage
import subprocess
def main():
"""Main function"""
arguments = ''
if len(sys.argv) > 1:
arguments = ' '.join(sys.argv[1:])
test... |
a7f24ba803c13bf7b263aed4d974ad604d53df2f | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
__author__ = "Nitrax <nitrax@lokisec.fr>"
__copyright__ = "Copyright 2017, Legobot"
description = 'Lego providing networking tools'
name = 'legos.nettools'
setup(
name=name,
version='0.1.0',
namespace_packages=name.split('.')[:-1],
lic... | #!/usr/bin/env python
from setuptools import setup, find_packages
__author__ = "Nitrax <nitrax@lokisec.fr>"
__copyright__ = "Copyright 2017, Legobot"
description = 'Lego providing networking tools'
name = 'legos.nettools'
setup(
name=name,
version='0.1.0',
namespace_packages=name.split('.')[:-1],
lic... | Fix trove classifier for pypi | Fix trove classifier for pypi
| Python | mit | Legobot/legos.nettools | #!/usr/bin/env python
from setuptools import setup, find_packages
__author__ = "Nitrax <nitrax@lokisec.fr>"
__copyright__ = "Copyright 2017, Legobot"
description = 'Lego providing networking tools'
name = 'legos.nettools'
setup(
name=name,
version='0.1.0',
namespace_packages=name.split('.')[:-1],
lic... | Fix trove classifier for pypi
#!/usr/bin/env python
from setuptools import setup, find_packages
__author__ = "Nitrax <nitrax@lokisec.fr>"
__copyright__ = "Copyright 2017, Legobot"
description = 'Lego providing networking tools'
name = 'legos.nettools'
setup(
name=name,
version='0.1.0',
namespace_package... |
2497f494f0e3e7fb57aa8cb1deed0c05fd6b74b1 | handler/FilesService.py | handler/FilesService.py | import tornado
import time
from bson.json_util import dumps
from tornado.options import options
class FilesServiceHandler(tornado.web.RequestHandler):
def initialize(self, logger, mongodb):
self.logger = logger
self.mongodb = mongodb
@tornado.web.asynchronous
@tornado.gen.coroutine
de... | import tornado
import time
from bson.json_util import dumps
from tornado.options import options
class FilesServiceHandler(tornado.web.RequestHandler):
def initialize(self, logger, mongodb):
self.logger = logger
self.mongodb = mongodb[options.db_name]['Files']
@tornado.web.asynchronous
@to... | Save file info in DB | Save file info in DB
| Python | apache-2.0 | jiss-software/jiss-file-service,jiss-software/jiss-file-service,jiss-software/jiss-file-service | import tornado
import time
from bson.json_util import dumps
from tornado.options import options
class FilesServiceHandler(tornado.web.RequestHandler):
def initialize(self, logger, mongodb):
self.logger = logger
self.mongodb = mongodb[options.db_name]['Files']
@tornado.web.asynchronous
@to... | Save file info in DB
import tornado
import time
from bson.json_util import dumps
from tornado.options import options
class FilesServiceHandler(tornado.web.RequestHandler):
def initialize(self, logger, mongodb):
self.logger = logger
self.mongodb = mongodb
@tornado.web.asynchronous
@tornad... |
82e964dab398caee75c3174f86593ab6cfa7dbaf | src/constants.py | src/constants.py | #!/usr/bin/env python
TRAJECTORY = 'linear'
if TRAJECTORY == 'linear':
SIMULATION_TIME_IN_SECONDS = 40.0
elif TRAJECTORY == 'circular':
SIMULATION_TIME_IN_SECONDS = 120.0
elif TRAJECTORY == 'squared':
SIMULATION_TIME_IN_SECONDS = 160.0
DELTA_T = 0.1 # this is the sampling time
STEPS = int(SIMULATION_TIME_... | #!/usr/bin/env python
TRAJECTORY = 'linear'
if TRAJECTORY == 'linear':
SIMULATION_TIME_IN_SECONDS = 80.0
elif TRAJECTORY == 'circular':
SIMULATION_TIME_IN_SECONDS = 120.0
elif TRAJECTORY == 'squared':
SIMULATION_TIME_IN_SECONDS = 160.0
DELTA_T = 0.1 # this is the sampling time
STEPS = int(SIMULATION_TIME_... | Increase simulation time for linear trajectory | Increase simulation time for linear trajectory
| Python | mit | bit0001/trajectory_tracking,bit0001/trajectory_tracking | #!/usr/bin/env python
TRAJECTORY = 'linear'
if TRAJECTORY == 'linear':
SIMULATION_TIME_IN_SECONDS = 80.0
elif TRAJECTORY == 'circular':
SIMULATION_TIME_IN_SECONDS = 120.0
elif TRAJECTORY == 'squared':
SIMULATION_TIME_IN_SECONDS = 160.0
DELTA_T = 0.1 # this is the sampling time
STEPS = int(SIMULATION_TIME_... | Increase simulation time for linear trajectory
#!/usr/bin/env python
TRAJECTORY = 'linear'
if TRAJECTORY == 'linear':
SIMULATION_TIME_IN_SECONDS = 40.0
elif TRAJECTORY == 'circular':
SIMULATION_TIME_IN_SECONDS = 120.0
elif TRAJECTORY == 'squared':
SIMULATION_TIME_IN_SECONDS = 160.0
DELTA_T = 0.1 # this ... |
6c820df40cf410314679c08502ba41a44b489b45 | senlin/tests/tempest/api/api_versions/test_api_version_show.py | senlin/tests/tempest/api/api_versions/test_api_version_show.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add tempest API test for API version show | Add tempest API test for API version show
This patch add tempest API test for API version show.
Change-Id: I1cf7cba550bb04629acab9899be310fd3b767576
| Python | apache-2.0 | openstack/senlin,openstack/senlin,stackforge/senlin,stackforge/senlin,openstack/senlin | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add tempest API test for API version show
This patch add tempest API test for API version show.
Change-Id: I1cf7cba550bb04629acab9899be310fd3b767576
| |
d4b962c599a751db46e4dec2ead9828a3529c453 | getTwitter.py | getTwitter.py | import urllib2
from BeautifulSoup import *
print 'Welcome to the Get Twitter tool. This tool will allow you to download a page from Twitter to be used to extract the data'
userResponse = raw_input("Please enter the full URL from the Tweet page")
response = urllib2.urlopen(userResponse)
html = response.read()
soup = ... | import time
import urllib2
from BeautifulSoup import *
# from bs4 import *
print 'Welcome to the Get Twitter tool. This tool will allow you to download a page from Twitter to be used to extract the data.'
print "Current date & time {}".format(time.strftime("%c"))
userResponse = raw_input("Please enter the full URL f... | Call html page the date and time of get request | Call html page the date and time of get request
The html file that is outputted how has the current date and time as its name | Python | artistic-2.0 | christaylortf/FinalYearProject | import time
import urllib2
from BeautifulSoup import *
# from bs4 import *
print 'Welcome to the Get Twitter tool. This tool will allow you to download a page from Twitter to be used to extract the data.'
print "Current date & time {}".format(time.strftime("%c"))
userResponse = raw_input("Please enter the full URL f... | Call html page the date and time of get request
The html file that is outputted how has the current date and time as its name
import urllib2
from BeautifulSoup import *
print 'Welcome to the Get Twitter tool. This tool will allow you to download a page from Twitter to be used to extract the data'
userResponse = raw_... |
e8b44733ff44162f4a01de76b66046af23a9c946 | tcconfig/_error.py | tcconfig/_error.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
class NetworkInterfaceNotFoundError(Exception):
"""
Exception raised when network interface not found.
"""
class ModuleNotFoundError(Exception):
"""
Exception raised... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
class NetworkInterfaceNotFoundError(Exception):
"""
Exception raised when network interface not found.
"""
class ModuleNotFoundError(Exception):
"""
Exception raised... | Add custom arguments for InvalidParameterError | Add custom arguments for InvalidParameterError
| Python | mit | thombashi/tcconfig,thombashi/tcconfig | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
class NetworkInterfaceNotFoundError(Exception):
"""
Exception raised when network interface not found.
"""
class ModuleNotFoundError(Exception):
"""
Exception raised... | Add custom arguments for InvalidParameterError
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
class NetworkInterfaceNotFoundError(Exception):
"""
Exception raised when network interface not found.
"""
class ModuleNotFou... |
7dacd28007097f83713b08d8b768d8ba8f6629d2 | src/unittest/python/stack_configuration/stack_configuration_tests.py | src/unittest/python/stack_configuration/stack_configuration_tests.py | import unittest2
from cfn_sphere.stack_configuration import Config, StackConfig, NoConfigException
class ConfigTests(unittest2.TestCase):
def test_properties_parsing(self):
config = Config(config_dict={'region': 'eu-west-1', 'stacks': {'foo': {'template-url': 'foo.json'}}})
self.assertEqual('eu-w... | import unittest2
from cfn_sphere.stack_configuration import Config, StackConfig, NoConfigException
class ConfigTests(unittest2.TestCase):
def test_properties_parsing(self):
config = Config(config_dict={'region': 'eu-west-1', 'stacks': {'any-stack': {'template-url': 'foo.json', 'tags': {'any-tag': 'any-ta... | Make test variables more descriptive | refactor: Make test variables more descriptive
| Python | apache-2.0 | ImmobilienScout24/cfn-sphere,cfn-sphere/cfn-sphere,marco-hoyer/cfn-sphere,cfn-sphere/cfn-sphere,cfn-sphere/cfn-sphere | import unittest2
from cfn_sphere.stack_configuration import Config, StackConfig, NoConfigException
class ConfigTests(unittest2.TestCase):
def test_properties_parsing(self):
config = Config(config_dict={'region': 'eu-west-1', 'stacks': {'any-stack': {'template-url': 'foo.json', 'tags': {'any-tag': 'any-ta... | refactor: Make test variables more descriptive
import unittest2
from cfn_sphere.stack_configuration import Config, StackConfig, NoConfigException
class ConfigTests(unittest2.TestCase):
def test_properties_parsing(self):
config = Config(config_dict={'region': 'eu-west-1', 'stacks': {'foo': {'template-url... |
3a17b72b82d2b23a676b92bd3292e04b77796ba7 | dock/__init__.py | dock/__init__.py | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
constants
"""
import logging
def set_logging(name="dock", level=logging.DEBUG):
# create logger
logger = logging.getLogger(name)
l... | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
constants
"""
import logging
def set_logging(name="dock", level=logging.DEBUG, handler=None):
# create logger
logger = logging.getLogg... | Allow redirecting dock's logs to a given handler only | Allow redirecting dock's logs to a given handler only
| Python | bsd-3-clause | david-martin/atomic-reactor,fr34k8/atomic-reactor,jpopelka/atomic-reactor,shaded-enmity/atomic-reactor,DBuildService/atomic-reactor,DBuildService/atomic-reactor,vrutkovs/atomic-reactor,fatherlinux/atomic-reactor,fr34k8/atomic-reactor,mmilata/atomic-reactor,jpopelka/atomic-reactor,maxamillion/atomic-reactor,mmilata/atom... | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
constants
"""
import logging
def set_logging(name="dock", level=logging.DEBUG, handler=None):
# create logger
logger = logging.getLogg... | Allow redirecting dock's logs to a given handler only
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
constants
"""
import logging
def set_logging(name="dock", level=logging.DEBUG):
# c... |
59a717588c9f0e76d532516a0c38624042527291 | testing/plot_test_data.py | testing/plot_test_data.py |
import zephyr.util
from zephyr.collector import MeasurementCollector
from zephyr.bioharness import BioHarnessSignalAnalysis, BioHarnessPacketHandler
from zephyr.message import MessagePayloadParser
from zephyr.testing import visualize_measurements, test_data_dir, VirtualSerial
from zephyr.protocol import Protocol... |
import zephyr.util
from zephyr.collector import MeasurementCollector
from zephyr.bioharness import BioHarnessSignalAnalysis, BioHarnessPacketHandler
from zephyr.message import MessagePayloadParser
from zephyr.testing import visualize_measurements, test_data_dir, VirtualSerial
from zephyr.protocol import Protocol... | Fix test data plotting to use the changed interfaces | Fix test data plotting to use the changed interfaces | Python | bsd-2-clause | jpaalasm/zephyr-bt |
import zephyr.util
from zephyr.collector import MeasurementCollector
from zephyr.bioharness import BioHarnessSignalAnalysis, BioHarnessPacketHandler
from zephyr.message import MessagePayloadParser
from zephyr.testing import visualize_measurements, test_data_dir, VirtualSerial
from zephyr.protocol import Protocol... | Fix test data plotting to use the changed interfaces
import zephyr.util
from zephyr.collector import MeasurementCollector
from zephyr.bioharness import BioHarnessSignalAnalysis, BioHarnessPacketHandler
from zephyr.message import MessagePayloadParser
from zephyr.testing import visualize_measurements, test_data_dir... |
0f497f4973317588c22044ea78da8a7147eeef19 | docs/conf.py | docs/conf.py | import guzzle_sphinx_theme
project = "argcomplete"
copyright = "Andrey Kislyuk"
author = "Andrey Kislyuk"
version = ""
release = ""
language = None
master_doc = "index"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
source_suffix = [".rst", ".md"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
pyg... | import guzzle_sphinx_theme
project = "argcomplete"
copyright = "Andrey Kislyuk and argcomplete contributors"
author = "Andrey Kislyuk"
version = ""
release = ""
language = None
master_doc = "index"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
source_suffix = [".rst", ".md"]
exclude_patterns = ["_build", ... | Adjust copyright line in docs | Adjust copyright line in docs
| Python | apache-2.0 | kislyuk/argcomplete,kislyuk/argcomplete | import guzzle_sphinx_theme
project = "argcomplete"
copyright = "Andrey Kislyuk and argcomplete contributors"
author = "Andrey Kislyuk"
version = ""
release = ""
language = None
master_doc = "index"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
source_suffix = [".rst", ".md"]
exclude_patterns = ["_build", ... | Adjust copyright line in docs
import guzzle_sphinx_theme
project = "argcomplete"
copyright = "Andrey Kislyuk"
author = "Andrey Kislyuk"
version = ""
release = ""
language = None
master_doc = "index"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
source_suffix = [".rst", ".md"]
exclude_patterns = ["_build"... |
3157151d835377a4ddf80d5514ea1edc0a2a8203 | account/decorators.py | account/decorators.py | import functools
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.decorators import available_attrs
from account.utils import handle_redirect_to_login
def login_required(func=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator for views that checks that the use... | import functools
from django.contrib.auth import REDIRECT_FIELD_NAME
from account.utils import handle_redirect_to_login
def login_required(func=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator for views that checks that the user is logged in, redirecting
to the log in page i... | Fix a 3.0 compat issue | Fix a 3.0 compat issue
| Python | mit | pinax/django-user-accounts,pinax/django-user-accounts | import functools
from django.contrib.auth import REDIRECT_FIELD_NAME
from account.utils import handle_redirect_to_login
def login_required(func=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator for views that checks that the user is logged in, redirecting
to the log in page i... | Fix a 3.0 compat issue
import functools
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.decorators import available_attrs
from account.utils import handle_redirect_to_login
def login_required(func=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator for views ... |
76fa14f61811cd38f2c91851a648fa88f6142b15 | django_evolution/utils.py | django_evolution/utils.py | from django_evolution.db import evolver
def write_sql(sql):
"Output a list of SQL statements, unrolling parameters as required"
for statement in sql:
if isinstance(statement, tuple):
print unicode(statement[0] % tuple(evolver.quote_sql_param(s) for s in statement[1]))
else:
... | from django_evolution.db import evolver
def write_sql(sql):
"Output a list of SQL statements, unrolling parameters as required"
for statement in sql:
if isinstance(statement, tuple):
print unicode(statement[0] % tuple(evolver.quote_sql_param(s) for s in statement[1]))
else:
... | Revert a debugging change that slipped in. | Revert a debugging change that slipped in.
git-svn-id: 48f3d5eb0141859d8d7d81547b6bd7b3dde885f8@186 8655a95f-0638-0410-abc2-2f1ed958ef3d
| Python | bsd-3-clause | clones/django-evolution | from django_evolution.db import evolver
def write_sql(sql):
"Output a list of SQL statements, unrolling parameters as required"
for statement in sql:
if isinstance(statement, tuple):
print unicode(statement[0] % tuple(evolver.quote_sql_param(s) for s in statement[1]))
else:
... | Revert a debugging change that slipped in.
git-svn-id: 48f3d5eb0141859d8d7d81547b6bd7b3dde885f8@186 8655a95f-0638-0410-abc2-2f1ed958ef3d
from django_evolution.db import evolver
def write_sql(sql):
"Output a list of SQL statements, unrolling parameters as required"
for statement in sql:
if isinstance(... |
e9cd60485ebfbe0afee60a70aea318e3e820f948 | setup.py | setup.py | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def get_readme():
return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
author="Julio Gonzalez Altamirano",
author_email='devjga@gmail.com',
classifiers=[
'Intended Audience :: Developers',... | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def get_readme():
return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
author="Julio Gonzalez Altamirano",
author_email='devjga@gmail.com',
classifiers=[
'Intended Audience :: Developers',... | Add table generation console script. | Add table generation console script.
| Python | mit | jga/capmetrics-etl,jga/capmetrics-etl | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def get_readme():
return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
author="Julio Gonzalez Altamirano",
author_email='devjga@gmail.com',
classifiers=[
'Intended Audience :: Developers',... | Add table generation console script.
#!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def get_readme():
return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
author="Julio Gonzalez Altamirano",
author_email='devjga@gmail.com',
classifiers=[
... |
b16bd59125fc5a800f5806f713fda3da4446d73c | pokemongo_bot/cell_workers/utils.py | pokemongo_bot/cell_workers/utils.py | # -*- coding: utf-8 -*-
import struct
from math import cos, asin, sqrt
def distance(lat1, lon1, lat2, lon2):
p = 0.017453292519943295
a = 0.5 - cos((lat2 - lat1) * p)/2 + cos(lat1 * p) * cos(lat2 * p) * (1 - cos((lon2 - lon1) * p)) / 2
return 12742 * asin(sqrt(a)) * 1000
def i2f(int):
return struct.u... | # -*- coding: utf-8 -*-
import struct
from math import cos, asin, sqrt
def distance(lat1, lon1, lat2, lon2):
p = 0.017453292519943295
a = 0.5 - cos((lat2 - lat1) * p)/2 + cos(lat1 * p) * cos(lat2 * p) * (1 - cos((lon2 - lon1) * p)) / 2
return 12742 * asin(sqrt(a)) * 1000
def i2f(int):
return struct.u... | Fix encoding error when printing messages | Fix encoding error when printing messages
Some messages that will be printed will contain utf-8 chars, e.g. Pokestops in European locations. | Python | mit | joergpatz/PokemonGo-Bot,dtee/PokemonGo-Bot,lythien/pokemongo,codybaldwin/PokemonGo-Bot,dhluong90/PokemonGo-Bot,dtee/PokemonGo-Bot,Gobberwart/PokemonGo-Bot,tibotic/simple-pokemongo-bot,yahwes/PokemonGo-Bot,Gobberwart/PokemonGo-Bot,Gobberwart/PokemonGo-Bot,halsafar/PokemonGo-Bot,bbiiggppiigg/PokemonGo-Bot,heihachi/Pokemo... | # -*- coding: utf-8 -*-
import struct
from math import cos, asin, sqrt
def distance(lat1, lon1, lat2, lon2):
p = 0.017453292519943295
a = 0.5 - cos((lat2 - lat1) * p)/2 + cos(lat1 * p) * cos(lat2 * p) * (1 - cos((lon2 - lon1) * p)) / 2
return 12742 * asin(sqrt(a)) * 1000
def i2f(int):
return struct.u... | Fix encoding error when printing messages
Some messages that will be printed will contain utf-8 chars, e.g. Pokestops in European locations.
# -*- coding: utf-8 -*-
import struct
from math import cos, asin, sqrt
def distance(lat1, lon1, lat2, lon2):
p = 0.017453292519943295
a = 0.5 - cos((lat2 - lat1) * p)/2... |
cff7bb0fda7e126ce65701231cab0e67a5a2794c | endpoints.py | endpoints.py | import requests
class AlgoliaEndpoint(object):
"""Class used to call the Algolia API and parse the response."""
URL = "http://hn.algolia.com/api/v1/search_by_date"
@staticmethod
def get(tag, since, until=None, page=0):
"""Send a GET request to the endpoint.
Since Algolia only returns JSON, parse it... | import requests
class AlgoliaEndpoint(object):
"""Class used to call the Algolia API and parse the response."""
URL = "http://hn.algolia.com/api/v1/search_by_date"
@staticmethod
def get(tag, since, until=None, page=0):
"""Send a GET request to the endpoint.
Since Algolia only returns JSON, parse it... | Add Algolia API website in docstring. | Add Algolia API website in docstring.
| Python | bsd-2-clause | NiGhTTraX/hackernews-scraper | import requests
class AlgoliaEndpoint(object):
"""Class used to call the Algolia API and parse the response."""
URL = "http://hn.algolia.com/api/v1/search_by_date"
@staticmethod
def get(tag, since, until=None, page=0):
"""Send a GET request to the endpoint.
Since Algolia only returns JSON, parse it... | Add Algolia API website in docstring.
import requests
class AlgoliaEndpoint(object):
"""Class used to call the Algolia API and parse the response."""
URL = "http://hn.algolia.com/api/v1/search_by_date"
@staticmethod
def get(tag, since, until=None, page=0):
"""Send a GET request to the endpoint.
Si... |
b9e61db86efd788f8ee321a3dbfcf09293d92337 | speedinfo/conf.py | speedinfo/conf.py | # coding: utf-8
from django.conf import settings
DEFAULTS = {
"SPEEDINFO_TESTS": False,
"SPEEDINFO_CACHED_RESPONSE_ATTR_NAME": "is_cached",
"SPEEDINFO_STORAGE": None,
"SPEEDINFO_CACHE_STORAGE_CACHE_ALIAS": "default",
"SPEEDINFO_PROFILING_CONDITIONS": [],
"SPEEDINFO_EXCLUDE_URLS": [],
"SPEE... | # coding: utf-8
from django.conf import settings
DEFAULTS = {
"SPEEDINFO_TESTS": False,
"SPEEDINFO_CACHED_RESPONSE_ATTR_NAME": "_is_cached",
"SPEEDINFO_STORAGE": None,
"SPEEDINFO_CACHE_STORAGE_CACHE_ALIAS": "default",
"SPEEDINFO_PROFILING_CONDITIONS": [],
"SPEEDINFO_EXCLUDE_URLS": [],
"SPE... | Change SPEEDINFO_CACHED_RESPONSE_ATTR_NAME default value to `_is_cached` | Change SPEEDINFO_CACHED_RESPONSE_ATTR_NAME default value to `_is_cached`
| Python | mit | catcombo/django-speedinfo,catcombo/django-speedinfo,catcombo/django-speedinfo | # coding: utf-8
from django.conf import settings
DEFAULTS = {
"SPEEDINFO_TESTS": False,
"SPEEDINFO_CACHED_RESPONSE_ATTR_NAME": "_is_cached",
"SPEEDINFO_STORAGE": None,
"SPEEDINFO_CACHE_STORAGE_CACHE_ALIAS": "default",
"SPEEDINFO_PROFILING_CONDITIONS": [],
"SPEEDINFO_EXCLUDE_URLS": [],
"SPE... | Change SPEEDINFO_CACHED_RESPONSE_ATTR_NAME default value to `_is_cached`
# coding: utf-8
from django.conf import settings
DEFAULTS = {
"SPEEDINFO_TESTS": False,
"SPEEDINFO_CACHED_RESPONSE_ATTR_NAME": "is_cached",
"SPEEDINFO_STORAGE": None,
"SPEEDINFO_CACHE_STORAGE_CACHE_ALIAS": "default",
"SPEEDI... |
22ba81ee7bed81c3a1da4b8d2ace4c38a957b5dd | server.py | server.py | import bottle
import waitress
import controller
import breathe
if __name__ == '__main__':
bottle_app = bottle.app()
breather = breathe.Breathe()
my_controller = controller.Controller(bottle_app, breather)
waitress.serve(bottle_app, host='0.0.0.0', port=7000)
| import bottle
import waitress
import controller
import breathe
from pytz import timezone
from apscheduler.schedulers.background import BackgroundScheduler
bottle_app = bottle.app()
scheduler = BackgroundScheduler()
scheduler.configure(timezone=timezone('US/Pacific'))
breather = breathe.Breathe()
my_controller = contro... | Add scheduler. Schedule lights on for 9:00pm and lights off for 11:00pm | Add scheduler. Schedule lights on for 9:00pm and lights off for 11:00pm
| Python | mit | tipsqueal/duwamish-lighthouse,tipsqueal/duwamish-lighthouse,YonasBerhe/duwamish-lighthouse,illumenati/duwamish-lighthouse,illumenati/duwamish-lighthouse | import bottle
import waitress
import controller
import breathe
from pytz import timezone
from apscheduler.schedulers.background import BackgroundScheduler
bottle_app = bottle.app()
scheduler = BackgroundScheduler()
scheduler.configure(timezone=timezone('US/Pacific'))
breather = breathe.Breathe()
my_controller = contro... | Add scheduler. Schedule lights on for 9:00pm and lights off for 11:00pm
import bottle
import waitress
import controller
import breathe
if __name__ == '__main__':
bottle_app = bottle.app()
breather = breathe.Breathe()
my_controller = controller.Controller(bottle_app, breather)
waitress.serve(bottle_ap... |
6f83fb7dd071786dc01a015addbdb541e7eaf7db | meinberlin/apps/documents/migrations/0002_rename_document_to_chapter.py | meinberlin/apps/documents/migrations/0002_rename_document_to_chapter.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('meinberlin_documents', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
atomic=False
dependencies = [
('meinberlin_documents', '0001_initial'),
]
operations = [
migrations.RenameModel(
... | Work around a migration issue in sqlite | apps/documents: Work around a migration issue in sqlite
| Python | agpl-3.0 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
atomic=False
dependencies = [
('meinberlin_documents', '0001_initial'),
]
operations = [
migrations.RenameModel(
... | apps/documents: Work around a migration issue in sqlite
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('meinberlin_documents', '0001_initial'),
]
operations =... |
ede47b64d892878e21178aeda2a16f24db59567b | setup.py | setup.py | """Python Bindings for Psynteract.
"""
# This is built on the demo package as described at
# https://packaging.python.org/en/latest/distributing.html
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here ... | Add tentative support for installation via pip | Add tentative support for installation via pip
| Python | apache-2.0 | psynteract/psynteract-py | """Python Bindings for Psynteract.
"""
# This is built on the demo package as described at
# https://packaging.python.org/en/latest/distributing.html
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here ... | Add tentative support for installation via pip
| |
68b0f560322884967b817ad87cef8c1db9600dbd | app/main/errors.py | app/main/errors.py | from flask import render_template
from app.main import main
@main.app_errorhandler(400)
def page_not_found(e):
return _render_error_page(500)
@main.app_errorhandler(404)
def page_not_found(e):
return _render_error_page(404)
@main.app_errorhandler(500)
def exception(e):
return _render_error_page(500)
... | from flask import render_template
from app.main import main
@main.app_errorhandler(400)
def page_not_found(e):
print(e.message)
return _render_error_page(500)
@main.app_errorhandler(404)
def page_not_found(e):
print(e.message)
return _render_error_page(404)
@main.app_errorhandler(500)
def exceptio... | Add print statements for all error types | Add print statements for all error types
| Python | mit | alphagov/notify-frontend,alphagov/notify-frontend,alphagov/notify-frontend,alphagov/notify-frontend | from flask import render_template
from app.main import main
@main.app_errorhandler(400)
def page_not_found(e):
print(e.message)
return _render_error_page(500)
@main.app_errorhandler(404)
def page_not_found(e):
print(e.message)
return _render_error_page(404)
@main.app_errorhandler(500)
def exceptio... | Add print statements for all error types
from flask import render_template
from app.main import main
@main.app_errorhandler(400)
def page_not_found(e):
return _render_error_page(500)
@main.app_errorhandler(404)
def page_not_found(e):
return _render_error_page(404)
@main.app_errorhandler(500)
def exceptio... |
19a47d8390ed1db3f91568375bb2726ee56d24f3 | setup.py | setup.py | from setuptools import setup
PACKAGE_VERSION = '1.0'
deps = []
setup(name='wptserve',
version=PACKAGE_VERSION,
description="Python webserver intended for in web browser testing",
long_description=open("README.md").read(),
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifier... | from setuptools import setup
PACKAGE_VERSION = '1.0.1'
deps = []
setup(name='wptserve',
version=PACKAGE_VERSION,
description="Python webserver intended for in web browser testing",
long_description=open("README.md").read(),
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifi... | Update the version for manifest update | Update the version for manifest update
| Python | bsd-3-clause | youennf/wptserve | from setuptools import setup
PACKAGE_VERSION = '1.0.1'
deps = []
setup(name='wptserve',
version=PACKAGE_VERSION,
description="Python webserver intended for in web browser testing",
long_description=open("README.md").read(),
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifi... | Update the version for manifest update
from setuptools import setup
PACKAGE_VERSION = '1.0'
deps = []
setup(name='wptserve',
version=PACKAGE_VERSION,
description="Python webserver intended for in web browser testing",
long_description=open("README.md").read(),
# Get strings from http://pypi.p... |
0981fee3834467fcde7f2231ff3b7d35371b9d09 | cms/__init__.py | cms/__init__.py | """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
VERSION = (1, 7, 11)
| """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
VERSION = (1, 8)
| Bump version number for release. | Bump version number for release.
| Python | bsd-3-clause | lewiscollard/cms,jamesfoley/cms,dan-gamble/cms,danielsamuels/cms,dan-gamble/cms,dan-gamble/cms,jamesfoley/cms,lewiscollard/cms,danielsamuels/cms,danielsamuels/cms,jamesfoley/cms,jamesfoley/cms,lewiscollard/cms | """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
VERSION = (1, 8)
| Bump version number for release.
"""
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
VERSION = (1, 7, 11)
|
039768aeacbf2ad3ca3d498d035f2fcf1163ff8f | pi_gpio/meta.py | pi_gpio/meta.py | from flask.ext.restful import Resource, marshal
class BasicResource(Resource):
def __init__(self):
super(BasicResource, self).__init__()
def response(self, data, code):
return marshal(data, self.fields), code
| from flask.ext.restful import Resource, marshal, reqparse
class BasicResource(Resource):
def __init__(self):
super(BasicResource, self).__init__()
self.parser = reqparse.RequestParser()
def response(self, data, code):
return marshal(data, self.fields), code
| Add parser to basic resource | Add parser to basic resource
| Python | mit | thijstriemstra/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,thijstriemstra/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server | from flask.ext.restful import Resource, marshal, reqparse
class BasicResource(Resource):
def __init__(self):
super(BasicResource, self).__init__()
self.parser = reqparse.RequestParser()
def response(self, data, code):
return marshal(data, self.fields), code
| Add parser to basic resource
from flask.ext.restful import Resource, marshal
class BasicResource(Resource):
def __init__(self):
super(BasicResource, self).__init__()
def response(self, data, code):
return marshal(data, self.fields), code
|
4f0c3e800fbbfab2d576a82b5a1db20d7feb676e | linked_accounts/authentication.py | linked_accounts/authentication.py | from django.http import HttpResponse
from django.template import loader
from django.utils.crypto import salted_hmac, constant_time_compare
from django.contrib.auth.models import User
class HMACAuth(object):
def __init__(self, realm='API'):
self.realm = realm
def process_request(self, request):
... | from django.http import HttpResponse
from django.template import loader
from django.utils.crypto import salted_hmac, constant_time_compare
from django.contrib.auth.models import User
class HMACAuth(object):
def __init__(self, realm='API'):
self.realm = realm
def process_request(self, request):
... | Return is_authenticated true if we got user and it is active | Return is_authenticated true if we got user and it is active
| Python | mit | zen4ever/django-linked-accounts,zen4ever/django-linked-accounts | from django.http import HttpResponse
from django.template import loader
from django.utils.crypto import salted_hmac, constant_time_compare
from django.contrib.auth.models import User
class HMACAuth(object):
def __init__(self, realm='API'):
self.realm = realm
def process_request(self, request):
... | Return is_authenticated true if we got user and it is active
from django.http import HttpResponse
from django.template import loader
from django.utils.crypto import salted_hmac, constant_time_compare
from django.contrib.auth.models import User
class HMACAuth(object):
def __init__(self, realm='API'):
se... |
a8b6e3fd52796b17f5fd287e82364406f23461e0 | scripts/svmlight_sortcols.py | scripts/svmlight_sortcols.py | from sys import argv
from operator import itemgetter
if __name__ == "__main__":
if (len(argv) != 3):
print("Usage: " + argv[0] + " <input.svm> <output.svm>")
print("Example:")
print("input.svm:")
print("1 24:1 12:1 55:1")
print("0 84:1 82:1 15:1")
print("...")
... | Add helper script to sort svmlight files by column keys. | Add helper script to sort svmlight files by column keys.
| Python | apache-2.0 | YzPaul3/h2o-3,bospetersen/h2o-3,ChristosChristofidis/h2o-3,mrgloom/h2o-3,kyoren/https-github.com-h2oai-h2o-3,h2oai/h2o-3,michalkurka/h2o-3,junwucs/h2o-3,h2oai/h2o-3,nilbody/h2o-3,mathemage/h2o-3,kyoren/https-github.com-h2oai-h2o-3,mrgloom/h2o-3,tarasane/h2o-3,pchmieli/h2o-3,weaver-viii/h2o-3,ChristosChristofidis/h2o-3,... | from sys import argv
from operator import itemgetter
if __name__ == "__main__":
if (len(argv) != 3):
print("Usage: " + argv[0] + " <input.svm> <output.svm>")
print("Example:")
print("input.svm:")
print("1 24:1 12:1 55:1")
print("0 84:1 82:1 15:1")
print("...")
... | Add helper script to sort svmlight files by column keys.
| |
8268f13015b4b6da7f3b1ab25898bb403c2ae22d | scripts/compact_seriesly.py | scripts/compact_seriesly.py | from logger import logger
from seriesly import Seriesly
from perfrunner.settings import StatsSettings
def main():
s = Seriesly(StatsSettings.SERIESLY['host'])
for db in s.list_dbs():
logger.info('Compacting {}'.format(db))
result = s[db].compact()
logger.info('Compaction finished: {}'... | Add a script for periodic compaction of Seriesly databases | CBPS-210: Add a script for periodic compaction of Seriesly databases
Change-Id: I95123c116c0dcdce4b4df02974d2a9fdeaef55dc
Reviewed-on: http://review.couchbase.org/69249
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail... | Python | apache-2.0 | couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner | from logger import logger
from seriesly import Seriesly
from perfrunner.settings import StatsSettings
def main():
s = Seriesly(StatsSettings.SERIESLY['host'])
for db in s.list_dbs():
logger.info('Compacting {}'.format(db))
result = s[db].compact()
logger.info('Compaction finished: {}'... | CBPS-210: Add a script for periodic compaction of Seriesly databases
Change-Id: I95123c116c0dcdce4b4df02974d2a9fdeaef55dc
Reviewed-on: http://review.couchbase.org/69249
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail... | |
ff65853def5bf1044fe457362f85b8aecca66152 | tests/laser/transaction/create.py | tests/laser/transaction/create.py | import mythril.laser.ethereum.transaction as transaction
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
from datetime import datetime
from mythril.ether.soliditycontract import SolidityContract
import tests
from mythril.analysis.security ... | from mythril.laser.ethereum.transaction import execute_contract_creation
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
from datetime import datetime
from mythril.ether.soliditycontract import SolidityContract
import tests
from mythril.an... | Update test to reflect the refactor | Update test to reflect the refactor
| Python | mit | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | from mythril.laser.ethereum.transaction import execute_contract_creation
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
from datetime import datetime
from mythril.ether.soliditycontract import SolidityContract
import tests
from mythril.an... | Update test to reflect the refactor
import mythril.laser.ethereum.transaction as transaction
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
from datetime import datetime
from mythril.ether.soliditycontract import SolidityContract
import ... |
4b183fb87952404e5a71ffd5c52ea1bba5bfc2b9 | csv2ofx/mappings/stripe.py | csv2ofx/mappings/stripe.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
# pylint: disable=invalid-name
"""
csv2ofx.mappings.stripe
~~~~~~~~~~~~~~~~~~~~~~~~
Provides a mapping for transactions obtained via Stripe card processing
Note that Stripe provides a Default set of columns or you can download All columns. (as well as custom).
The De... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
# pylint: disable=invalid-name
"""
csv2ofx.mappings.stripe
~~~~~~~~~~~~~~~~~~~~~~~~
Provides a mapping for transactions obtained via Stripe card processing
Note that Stripe provides a Default set of columns or you can download
All columns. (as well as custom). The De... | Fix lint line length warnings (blocking manage checks) | Fix lint line length warnings (blocking manage checks)
| Python | mit | reubano/csv2ofx,reubano/csv2ofx | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
# pylint: disable=invalid-name
"""
csv2ofx.mappings.stripe
~~~~~~~~~~~~~~~~~~~~~~~~
Provides a mapping for transactions obtained via Stripe card processing
Note that Stripe provides a Default set of columns or you can download
All columns. (as well as custom). The De... | Fix lint line length warnings (blocking manage checks)
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
# pylint: disable=invalid-name
"""
csv2ofx.mappings.stripe
~~~~~~~~~~~~~~~~~~~~~~~~
Provides a mapping for transactions obtained via Stripe card processing
Note that Stripe provides a Default set of columns or y... |
2a99fc24fec47b741359e3118969ba0f4d874e41 | SettingsObject.py | SettingsObject.py | """
This class is used in kaggle competitions
"""
import json
class Settings():
train_path = None
test_path = None
model_path = None
submission_path = None
string_train_path = "TRAIN_DATA_PATH"
string_test_path = "TEST_DATA_PATH"
string_model_path = "MODEL_PATH"
string_submission_path ... | """
This class is used in kaggle competitions
"""
import json
class Settings():
train_path = None
test_path = None
model_path = None
submission_path = None
string_train_path = "TRAIN_DATA_PATH"
string_test_path = "TEST_DATA_PATH"
string_model_path = "MODEL_PATH"
string_submission_path ... | Remove not necessary code in Setting class | Remove not necessary code in Setting class
| Python | apache-2.0 | Gabvaztor/TFBoost | """
This class is used in kaggle competitions
"""
import json
class Settings():
train_path = None
test_path = None
model_path = None
submission_path = None
string_train_path = "TRAIN_DATA_PATH"
string_test_path = "TEST_DATA_PATH"
string_model_path = "MODEL_PATH"
string_submission_path ... | Remove not necessary code in Setting class
"""
This class is used in kaggle competitions
"""
import json
class Settings():
train_path = None
test_path = None
model_path = None
submission_path = None
string_train_path = "TRAIN_DATA_PATH"
string_test_path = "TEST_DATA_PATH"
string_model_pat... |
357af01554cca6197d07a4a408c02921e70a14eb | cozify/multisensor.py | cozify/multisensor.py | import time
from influxdb import InfluxDBClient
from influxdb import SeriesHelper
from . import config
# expects Cozify devices type json data
def getMultisensorData(data):
out = []
for device in data:
state=data[device]['state']
devtype = state['type']
if devtype == 'STATE_MULTI_SEN... | import time
from . import config
# expects Cozify devices type json data
def getMultisensorData(data):
out = []
for device in data:
state=data[device]['state']
devtype = state['type']
if devtype == 'STATE_MULTI_SENSOR':
name=data[device]['name']
if 'lastSeen' i... | Remove outdated imports, oops sorry. | Remove outdated imports, oops sorry.
| Python | mit | Artanicus/python-cozify,Artanicus/python-cozify | import time
from . import config
# expects Cozify devices type json data
def getMultisensorData(data):
out = []
for device in data:
state=data[device]['state']
devtype = state['type']
if devtype == 'STATE_MULTI_SENSOR':
name=data[device]['name']
if 'lastSeen' i... | Remove outdated imports, oops sorry.
import time
from influxdb import InfluxDBClient
from influxdb import SeriesHelper
from . import config
# expects Cozify devices type json data
def getMultisensorData(data):
out = []
for device in data:
state=data[device]['state']
devtype = state['type']
... |
3a9568b4d4de969b1e2031e8d2d3cdd7bd56824f | zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py | zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def rename_zulip_realm_to_zulipinternal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> Non... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def rename_zulip_realm_to_zulipinternal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> Non... | Fix zulipinternal migration corner case. | migrations: Fix zulipinternal migration corner case.
It's theoretically possible to have configured a Zulip server where
the system bots live in the same realm as normal users (and may have
in fact been the default in early Zulip releases? Unclear.). We
should handle these without the migration intended to clean up ... | Python | apache-2.0 | brainwane/zulip,andersk/zulip,hackerkid/zulip,synicalsyntax/zulip,andersk/zulip,hackerkid/zulip,punchagan/zulip,shubhamdhama/zulip,showell/zulip,zulip/zulip,synicalsyntax/zulip,kou/zulip,rht/zulip,showell/zulip,brainwane/zulip,punchagan/zulip,shubhamdhama/zulip,hackerkid/zulip,andersk/zulip,kou/zulip,brainwane/zulip,br... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def rename_zulip_realm_to_zulipinternal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> Non... | migrations: Fix zulipinternal migration corner case.
It's theoretically possible to have configured a Zulip server where
the system bots live in the same realm as normal users (and may have
in fact been the default in early Zulip releases? Unclear.). We
should handle these without the migration intended to clean up ... |
75b82feac8ebc12450a44c5927579e30c604f973 | ibmcnx/doc/DataSources.py | ibmcnx/doc/DataSources.py | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | Create documentation of DataSource Settings | 8: Create documentation of DataSource Settings
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8 | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | 8: Create documentation of DataSource Settings
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8
######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
#... |
6dfd6a4ae687dc9c7567c74a6c3ef3bd0f9dc5a1 | ci_scripts/buildLinuxWheels.py | ci_scripts/buildLinuxWheels.py | from subprocess import call, check_output
import sys
import os
isPython3 = sys.version_info.major == 3
# https://stackoverflow.com/a/3357357
command = 'git log --format=%B -n 1'.split()
out = check_output(command)
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
path = os.path.abspath(sys.argv[1]... | from subprocess import call, check_output
import sys
import os
isPython3 = sys.version_info.major == 3
# https://stackoverflow.com/a/3357357
command = 'git log --format=%B -n 1'.split()
out = check_output(command)
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
path = os.path.abspath(sys.argv[1]... | Fix build wheels and upload 5. | Fix build wheels and upload 5.
| Python | bsd-3-clause | jr-garcia/AssimpCy,jr-garcia/AssimpCy | from subprocess import call, check_output
import sys
import os
isPython3 = sys.version_info.major == 3
# https://stackoverflow.com/a/3357357
command = 'git log --format=%B -n 1'.split()
out = check_output(command)
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
path = os.path.abspath(sys.argv[1]... | Fix build wheels and upload 5.
from subprocess import call, check_output
import sys
import os
isPython3 = sys.version_info.major == 3
# https://stackoverflow.com/a/3357357
command = 'git log --format=%B -n 1'.split()
out = check_output(command)
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
pa... |
f7a8f66047e2277cd95b553cd7aadfa24fbaad95 | scuole/stats/models.py | scuole/stats/models.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SchoolYear(models.Model):
name = models.CharField(max_length=9)
def __str__(self):
return sel... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SchoolYear(models.Model):
name = models.CharField(max_length=9)
def __str__(self):
return sel... | Add two more fields to StatsBase | Add two more fields to StatsBase
| Python | mit | texastribune/scuole,texastribune/scuole,texastribune/scuole,texastribune/scuole | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SchoolYear(models.Model):
name = models.CharField(max_length=9)
def __str__(self):
return sel... | Add two more fields to StatsBase
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SchoolYear(models.Model):
name = models.CharField(max_length=9)
def... |
d411a3cdc16b68647059c007cff3091ecf3ed9dc | gaia_tools/query/__init__.py | gaia_tools/query/__init__.py | # gaia_tools.query: some helper functions for querying the Gaia database
import numpy
from astropy.table import Table
from astroquery.gaia import Gaia
import psycopg2
def query(sql_query,local=False,dbname='catalogs',user='postgres'):
"""
NAME:
query
PURPOSE:
perform a query, either on a loca... | Add function to run a local or remote query | Add function to run a local or remote query
| Python | mit | jobovy/gaia_tools | # gaia_tools.query: some helper functions for querying the Gaia database
import numpy
from astropy.table import Table
from astroquery.gaia import Gaia
import psycopg2
def query(sql_query,local=False,dbname='catalogs',user='postgres'):
"""
NAME:
query
PURPOSE:
perform a query, either on a loca... | Add function to run a local or remote query
| |
411f6dfb62f5aa6c91d35aeb6acb0d7246961849 | examples/petstore/psflask.py | examples/petstore/psflask.py | import pickle
from flask import Flask, abort
app = Flask(__name__)
import petstore_impl
import petstore_server
store = petstore_impl.PetStore()
server = petstore_server.PetStore_server(store)
@app.route("/" + petstore_server.service_name + "/<args>")
def run_service(args):
try:
command, args, kwargs = p... | Add Flask equivalent for psserver and sample_rpc | Add Flask equivalent for psserver and sample_rpc
| Python | apache-2.0 | datawire/adaptive | import pickle
from flask import Flask, abort
app = Flask(__name__)
import petstore_impl
import petstore_server
store = petstore_impl.PetStore()
server = petstore_server.PetStore_server(store)
@app.route("/" + petstore_server.service_name + "/<args>")
def run_service(args):
try:
command, args, kwargs = p... | Add Flask equivalent for psserver and sample_rpc
| |
45275a48fb434e6a9d895da03e290b84c52694f6 | orbitdeterminator/kep_determination/least_squares.py | orbitdeterminator/kep_determination/least_squares.py | """Computes the least-squares optimal Keplerian elements for a sequence of
cartesian position observations.
"""
import numpy as np
import matplotlib.pyplot as plt
# convention:
# a: semi-major axis
# e: eccentricity
# eps: mean longitude at epoch
# Euler angles:
# I: inclination
# Omega: longitude of ascending nod... | """Computes the least-squares optimal Keplerian elements for a sequence of
cartesian position observations.
"""
import math
import numpy as np
import matplotlib.pyplot as plt
# convention:
# a: semi-major axis
# e: eccentricity
# eps: mean longitude at epoch
# Euler angles:
# I: inclination
# Omega: longitude of a... | Add rotation matrix, from orbital plane to inertial frame | Add rotation matrix, from orbital plane to inertial frame
| Python | mit | aerospaceresearch/orbitdeterminator | """Computes the least-squares optimal Keplerian elements for a sequence of
cartesian position observations.
"""
import math
import numpy as np
import matplotlib.pyplot as plt
# convention:
# a: semi-major axis
# e: eccentricity
# eps: mean longitude at epoch
# Euler angles:
# I: inclination
# Omega: longitude of a... | Add rotation matrix, from orbital plane to inertial frame
"""Computes the least-squares optimal Keplerian elements for a sequence of
cartesian position observations.
"""
import numpy as np
import matplotlib.pyplot as plt
# convention:
# a: semi-major axis
# e: eccentricity
# eps: mean longitude at epoch
# Euler a... |
3fcb449325713fa9bfffe737b09dab333675766b | gnowsys-ndf/gnowsys_ndf/ndf/management/commands/update_attribute_type.py | gnowsys-ndf/gnowsys_ndf/ndf/management/commands/update_attribute_type.py | ''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError
from django_mongokit import get_database
try:
from bson import ObjectId
except ImportError: # old pymongo
from pymongo.objectid import ObjectId
''' imports from application folders/files '''
from gnowsy... | Update script for updating attribute_type field of GAttribute instances from ObjectId to DBRef (AttributeType) | Update script for updating attribute_type field of GAttribute instances from ObjectId to DBRef (AttributeType)
| Python | agpl-3.0 | AvadootNachankar/gstudio,supriyasawant/gstudio,gnowledge/gstudio,gnowledge/gstudio,olympian94/gstudio,sunnychaudhari/gstudio,makfire/gstudio,olympian94/gstudio,AvadootNachankar/gstudio,gnowledge/gstudio,makfire/gstudio,AvadootNachankar/gstudio,supriyasawant/gstudio,sunnychaudhari/gstudio,Dhiru/gstudio,makfire/gstudio,s... | ''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError
from django_mongokit import get_database
try:
from bson import ObjectId
except ImportError: # old pymongo
from pymongo.objectid import ObjectId
''' imports from application folders/files '''
from gnowsy... | Update script for updating attribute_type field of GAttribute instances from ObjectId to DBRef (AttributeType)
| |
c5671ab2e5115ce9c022a97a088300dc408e2aa4 | opendc/util/path_parser.py | opendc/util/path_parser.py | import json
import sys
import re
def parse(version, endpoint_path):
"""Map an HTTP call to an API path"""
with open('opendc/api/{}/paths.json'.format(version)) as paths_file:
paths = json.load(paths_file)
endpoint_path_parts = endpoint_path.split('/')
paths_parts = [x.split('/') for x in ... | import json
import sys
import re
def parse(version, endpoint_path):
"""Map an HTTP endpoint path to an API path"""
with open('opendc/api/{}/paths.json'.format(version)) as paths_file:
paths = json.load(paths_file)
endpoint_path_parts = endpoint_path.strip('/').split('/')
paths_parts = [x.... | Make path parser robust to trailing / | Make path parser robust to trailing /
| Python | mit | atlarge-research/opendc-web-server,atlarge-research/opendc-web-server | import json
import sys
import re
def parse(version, endpoint_path):
"""Map an HTTP endpoint path to an API path"""
with open('opendc/api/{}/paths.json'.format(version)) as paths_file:
paths = json.load(paths_file)
endpoint_path_parts = endpoint_path.strip('/').split('/')
paths_parts = [x.... | Make path parser robust to trailing /
import json
import sys
import re
def parse(version, endpoint_path):
"""Map an HTTP call to an API path"""
with open('opendc/api/{}/paths.json'.format(version)) as paths_file:
paths = json.load(paths_file)
endpoint_path_parts = endpoint_path.split('/')
... |
2fc45a6a0e2ba1efe06b4282234cf13c0ccd5b7d | dj_experiment/conf.py | dj_experiment/conf.py | from appconf import AppConf
from django.conf import settings
class DjExperimentAppConf(AppConf):
DATA_DIR = "./"
SEPARATOR = "."
OUTPUT_PREFIX = ""
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
class Meta:
prefix =... | import os
from appconf import AppConf
from django.conf import settings
class DjExperimentAppConf(AppConf):
DATA_DIR = "./"
BASE_DATA_DIR = os.path.join(settings.BASE_DIR, 'data')
SEPARATOR = "."
OUTPUT_PREFIX = ""
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'... | Add default base data dir for experiments | Add default base data dir for experiments
| Python | mit | francbartoli/dj-experiment,francbartoli/dj-experiment | import os
from appconf import AppConf
from django.conf import settings
class DjExperimentAppConf(AppConf):
DATA_DIR = "./"
BASE_DATA_DIR = os.path.join(settings.BASE_DIR, 'data')
SEPARATOR = "."
OUTPUT_PREFIX = ""
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'... | Add default base data dir for experiments
from appconf import AppConf
from django.conf import settings
class DjExperimentAppConf(AppConf):
DATA_DIR = "./"
SEPARATOR = "."
OUTPUT_PREFIX = ""
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND ... |
f11e56076e10d2c7e1db529751c53c1c5dc2074f | cihai/_compat.py | cihai/_compat.py | # -*- coding: utf8 -*-
# flake8: NOQA
import sys
PY2 = sys.version_info[0] == 2
if PY2:
unichr = unichr
text_type = unicode
string_types = (str, unicode)
integer_types = (int, long)
from urllib import urlretrieve
from cStringIO import StringIO as BytesIO
from StringIO import StringIO
... | # -*- coding: utf8 -*-
# flake8: NOQA
import sys
PY2 = sys.version_info[0] == 2
if PY2:
unichr = unichr
text_type = unicode
string_types = (str, unicode)
integer_types = (int, long)
from urllib import urlretrieve
from cStringIO import StringIO as BytesIO
from StringIO import StringIO
... | Revert "Port with_metaclass from flask" | Revert "Port with_metaclass from flask"
This reverts commit db23ed0d62789ca995d2dceefd0a1468348c488b.
| Python | mit | cihai/cihai,cihai/cihai-python,cihai/cihai | # -*- coding: utf8 -*-
# flake8: NOQA
import sys
PY2 = sys.version_info[0] == 2
if PY2:
unichr = unichr
text_type = unicode
string_types = (str, unicode)
integer_types = (int, long)
from urllib import urlretrieve
from cStringIO import StringIO as BytesIO
from StringIO import StringIO
... | Revert "Port with_metaclass from flask"
This reverts commit db23ed0d62789ca995d2dceefd0a1468348c488b.
# -*- coding: utf8 -*-
# flake8: NOQA
import sys
PY2 = sys.version_info[0] == 2
if PY2:
unichr = unichr
text_type = unicode
string_types = (str, unicode)
integer_types = (int, long)
from urllib ... |
4418f448e3c7d8a3b12e5e45038fd5a0ef6b6d07 | ectyper/subprocess_util.py | ectyper/subprocess_util.py | #!/usr/bin/env python
import logging
import subprocess
import timeit
LOG = logging.getLogger(__name__)
def run_subprocess(cmd, input_data=None, un=False):
"""
Run cmd command on subprocess
Args:
cmd (str): cmd command
Returns:
stdout (str): The stdout of cmd
"""
start_time... | #!/usr/bin/env python
import logging
import subprocess
import timeit
LOG = logging.getLogger(__name__)
def run_subprocess(cmd, input_data=None, un=False):
"""
Run cmd command on subprocess
Args:
cmd (str): cmd command
Returns:
stdout (str): The stdout of cmd
"""
start_time... | Include error message in debug. | Include error message in debug.
| Python | apache-2.0 | phac-nml/ecoli_serotyping | #!/usr/bin/env python
import logging
import subprocess
import timeit
LOG = logging.getLogger(__name__)
def run_subprocess(cmd, input_data=None, un=False):
"""
Run cmd command on subprocess
Args:
cmd (str): cmd command
Returns:
stdout (str): The stdout of cmd
"""
start_time... | Include error message in debug.
#!/usr/bin/env python
import logging
import subprocess
import timeit
LOG = logging.getLogger(__name__)
def run_subprocess(cmd, input_data=None, un=False):
"""
Run cmd command on subprocess
Args:
cmd (str): cmd command
Returns:
stdout (str): The stdo... |
eec47f7a6988d4472bc99789fcc7ba894b74c17b | files/install_workflow.py | files/install_workflow.py | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file'... | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file... | Use .get methods when retrieving uuid keys | Use .get methods when retrieving uuid keys
| Python | mit | anmoljh/ansible-galaxy-tools,galaxyproject/ansible-galaxy-tools,galaxyproject/ansible-tools,nuwang/ansible-galaxy-tools | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file... | Use .get methods when retrieving uuid keys
#!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--... |
f7aeb4fa5bafa5218bed14e5b19c0fb9409e6700 | examples/python/readMCParticles.py | examples/python/readMCParticles.py | #!/usr/bin/env python
#
# This is just a simple test script to check whether the python bindings are
# actually working as intended
from __future__ import print_function, absolute_import, unicode_literals
import pyLCIO as lcio
import sys
reader = lcio.IOIMPL.LCFactory.getInstance().createLCReader()
reader.open(sys.a... | Add small test script for python bindings | Add small test script for python bindings
| Python | bsd-3-clause | iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO | #!/usr/bin/env python
#
# This is just a simple test script to check whether the python bindings are
# actually working as intended
from __future__ import print_function, absolute_import, unicode_literals
import pyLCIO as lcio
import sys
reader = lcio.IOIMPL.LCFactory.getInstance().createLCReader()
reader.open(sys.a... | Add small test script for python bindings
| |
b28c448261d8310a801fe8824ab2852fd50960da | zinnia/urls/shortlink.py | zinnia/urls/shortlink.py | """Urls for the Zinnia entries short link"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.shortlink import EntryShortLink
urlpatterns = patterns(
'',
url(r'^e(?P<token>[\da-z]+)/$',
EntryShortLink.as_view(),
name='entry_shortlink'),
)
| """Urls for the Zinnia entries short link"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.shortlink import EntryShortLink
urlpatterns = patterns(
'',
url(r'^(?P<token>[\da-z]+)/$',
EntryShortLink.as_view(),
name='entry_shortlink'),
)
| Revert "Add a "e" prefix to avoid issue when reaching the ID 46656" | Revert "Add a "e" prefix to avoid issue when reaching the ID 46656"
This reverts commit e730c552c0b6095a8962f29a114069fb335d7ec6.
| Python | bsd-3-clause | aorzh/django-blog-zinnia,bywbilly/django-blog-zinnia,ghachey/django-blog-zinnia,marctc/django-blog-zinnia,dapeng0802/django-blog-zinnia,dapeng0802/django-blog-zinnia,aorzh/django-blog-zinnia,petecummings/django-blog-zinnia,ghachey/django-blog-zinnia,bywbilly/django-blog-zinnia,extertioner/django-blog-zinnia,Maplecroft/... | """Urls for the Zinnia entries short link"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.shortlink import EntryShortLink
urlpatterns = patterns(
'',
url(r'^(?P<token>[\da-z]+)/$',
EntryShortLink.as_view(),
name='entry_shortlink'),
)
| Revert "Add a "e" prefix to avoid issue when reaching the ID 46656"
This reverts commit e730c552c0b6095a8962f29a114069fb335d7ec6.
"""Urls for the Zinnia entries short link"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.shortlink import EntryShortLink
urlpatterns = patte... |
d616642e11c0151f44cdae6038d8cdae07abdf8c | setup.py | setup.py | from distutils.core import setup
setup(
name='Getty Art',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty_art'],
url='https://github.com/c-w/GettyArt',
download_url='http://pypi.python.org/pypi/GettyArt',
license='LICENSE.txt',
... | from distutils.core import setup
setup(
name='Getty Art',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty_art'],
url='https://github.com/c-w/GettyArt',
download_url='http://pypi.python.org/pypi/GettyArt',
license='LICENSE.txt',
... | Make tag-line consistent with GitHub | Make tag-line consistent with GitHub
| Python | mit | c-w/GettyArt | from distutils.core import setup
setup(
name='Getty Art',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty_art'],
url='https://github.com/c-w/GettyArt',
download_url='http://pypi.python.org/pypi/GettyArt',
license='LICENSE.txt',
... | Make tag-line consistent with GitHub
from distutils.core import setup
setup(
name='Getty Art',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty_art'],
url='https://github.com/c-w/GettyArt',
download_url='http://pypi.python.org/pypi/Gett... |
31ee04b2eed6881a4f6642495545868f7c167a20 | sipa/blueprints/hooks.py | sipa/blueprints/hooks.py | import logging
from flask import current_app, request, abort
from flask.blueprints import Blueprint
from sipa.utils.git_utils import update_repo
logger = logging.getLogger(__name__)
bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks')
@bp_hooks.route('/update-content', methods=['POST'])
def content_hook(... | import logging
from flask import current_app, request, abort
from flask.blueprints import Blueprint
from sipa.utils.git_utils import update_repo
logger = logging.getLogger(__name__)
bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks')
@bp_hooks.route('/update-content', methods=['POST'])
def content_hook(... | Use ascii in logging message | Use ascii in logging message
| Python | mit | MarauderXtreme/sipa,agdsn/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,agdsn/sipa,MarauderXtreme/sipa | import logging
from flask import current_app, request, abort
from flask.blueprints import Blueprint
from sipa.utils.git_utils import update_repo
logger = logging.getLogger(__name__)
bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks')
@bp_hooks.route('/update-content', methods=['POST'])
def content_hook(... | Use ascii in logging message
import logging
from flask import current_app, request, abort
from flask.blueprints import Blueprint
from sipa.utils.git_utils import update_repo
logger = logging.getLogger(__name__)
bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks')
@bp_hooks.route('/update-content', metho... |
02522262692554a499d7c0fbc8f2efe4361023f1 | bmi_ilamb/__init__.py | bmi_ilamb/__init__.py | import os
from .bmi_ilamb import BmiIlamb
__all__ = ['BmiIlamb']
__version__ = 0.1
package_dir = os.path.dirname(__file__)
data_dir = os.path.join(package_dir, 'data')
| import os
from .bmi_ilamb import BmiIlamb
from .config import Configuration
__all__ = ['BmiIlamb', 'Configuration']
__version__ = 0.1
package_dir = os.path.dirname(__file__)
data_dir = os.path.join(package_dir, 'data')
| Add Configuration to package definition | Add Configuration to package definition
| Python | mit | permamodel/bmi-ilamb | import os
from .bmi_ilamb import BmiIlamb
from .config import Configuration
__all__ = ['BmiIlamb', 'Configuration']
__version__ = 0.1
package_dir = os.path.dirname(__file__)
data_dir = os.path.join(package_dir, 'data')
| Add Configuration to package definition
import os
from .bmi_ilamb import BmiIlamb
__all__ = ['BmiIlamb']
__version__ = 0.1
package_dir = os.path.dirname(__file__)
data_dir = os.path.join(package_dir, 'data')
|
97919d06b252af37e7c955ff800b309599e2debc | usingnamespace/forms/user.py | usingnamespace/forms/user.py | import colander
import deform
from csrf import CSRFSchema
class LoginForm(CSRFSchema):
"""The user login form."""
username = colander.SchemaNode(colander.String(),
title="Username",
widget=deform.widget.TextInputWidget(css_class='form-control'),
)
password = colander.Sc... | import colander
import deform
from schemaform import SchemaFormMixin
from csrf import CSRFSchema
class LoginForm(CSRFSchema, SchemaFormMixin):
"""The user login form."""
username = colander.SchemaNode(colander.String(),
title="Username",
__buttons__ = (deform.form.Button(name=_("Submit"), css... | Add SchemaFormMixin to the LoginForm | Add SchemaFormMixin to the LoginForm
| Python | isc | usingnamespace/usingnamespace | import colander
import deform
from schemaform import SchemaFormMixin
from csrf import CSRFSchema
class LoginForm(CSRFSchema, SchemaFormMixin):
"""The user login form."""
username = colander.SchemaNode(colander.String(),
title="Username",
__buttons__ = (deform.form.Button(name=_("Submit"), css... | Add SchemaFormMixin to the LoginForm
import colander
import deform
from csrf import CSRFSchema
class LoginForm(CSRFSchema):
"""The user login form."""
username = colander.SchemaNode(colander.String(),
title="Username",
widget=deform.widget.TextInputWidget(css_class='form-control'),
... |
d145d2fe8666d4dbbc104bb563fc43415bd8802c | downloaders/downloader_factory.py | downloaders/downloader_factory.py | import logging
from argparse import Namespace
from downloaders import downloader
from downloaders.downloader import Downloader
from downloaders.reddit_downloader import RedditDownloader
LOGGER = logging.getLogger(__name__)
FOURCHAN_FILE_PATTERN = "4chan*_%s.*"
IMGUR_SITE_FILE_PATTERN = "imgur*_%s.*"
class Download... | import logging
from argparse import Namespace
from downloaders import downloader
from downloaders.downloader import Downloader
from downloaders.reddit_downloader import RedditDownloader
LOGGER = logging.getLogger(__name__)
FOURCHAN_FILE_PATTERN = "4chan*_%s.*"
IMGUR_SITE_FILE_PATTERN = "imgur*_%s.*"
class Download... | Add valitation for reddit domains when in URL mode | Add valitation for reddit domains when in URL mode
| Python | apache-2.0 | CharlieCorner/pymage_downloader | import logging
from argparse import Namespace
from downloaders import downloader
from downloaders.downloader import Downloader
from downloaders.reddit_downloader import RedditDownloader
LOGGER = logging.getLogger(__name__)
FOURCHAN_FILE_PATTERN = "4chan*_%s.*"
IMGUR_SITE_FILE_PATTERN = "imgur*_%s.*"
class Download... | Add valitation for reddit domains when in URL mode
import logging
from argparse import Namespace
from downloaders import downloader
from downloaders.downloader import Downloader
from downloaders.reddit_downloader import RedditDownloader
LOGGER = logging.getLogger(__name__)
FOURCHAN_FILE_PATTERN = "4chan*_%s.*"
IMGU... |
981d0473a24d52fb19e8da1a2af18c9f8823dd29 | heufybot/factory.py | heufybot/factory.py | from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory
from heufybot.connection import HeufyBotConnection
class HeufyBotFactory(ReconnectingClientFactory):
protocol = HeufyBotConnection
def __init__(self, bot):
self.bot = bot
self.currentlyDisconnecting = []
def b... | from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory
from heufybot.connection import HeufyBotConnection
class HeufyBotFactory(ReconnectingClientFactory):
protocol = HeufyBotConnection
def __init__(self, bot):
self.bot = bot
self.currentlyDisconnecting = []
def b... | Add an action for server disconnects | Add an action for server disconnects
| Python | mit | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory
from heufybot.connection import HeufyBotConnection
class HeufyBotFactory(ReconnectingClientFactory):
protocol = HeufyBotConnection
def __init__(self, bot):
self.bot = bot
self.currentlyDisconnecting = []
def b... | Add an action for server disconnects
from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory
from heufybot.connection import HeufyBotConnection
class HeufyBotFactory(ReconnectingClientFactory):
protocol = HeufyBotConnection
def __init__(self, bot):
self.bot = bot
self.... |
36fb88bf5f60a656defaafc7626c373e59a70e05 | tests/util.py | tests/util.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import functools
import os
class Env(object):
def __init__(self):
self.user = os.getenv('AWS_ACCESS_KEY_ID', None)
assert self.user, \
'Required environ... | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import functools
import os
class Env(object):
def __init__(self):
# self.user = os.getenv('AWS_ACCESS_KEY_ID', None)
# assert self.user, \
# 'Required e... | Comment out assertion of environment variables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). When test fail, all environment variables appear in the error log in some case. Use credential file(~/.aws/credential) configuration for testing. | Comment out assertion of environment variables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
When test fail, all environment variables appear in the error log in some case.
Use credential file(~/.aws/credential) configuration for testing.
| Python | mit | laughingman7743/PyAthenaJDBC,laughingman7743/PyAthenaJDBC | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import functools
import os
class Env(object):
def __init__(self):
# self.user = os.getenv('AWS_ACCESS_KEY_ID', None)
# assert self.user, \
# 'Required e... | Comment out assertion of environment variables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
When test fail, all environment variables appear in the error log in some case.
Use credential file(~/.aws/credential) configuration for testing.
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import... |
da4151a0e83e6738361b23edb2fda3ee0e386391 | localflavor/br/models.py | localflavor/br/models.py | from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from .br_states import STATE_CHOICES
class BRStateField(CharField):
"""
A model field for states of Brazil
"""
description = _("BR. state (two uppercase letters)")
def __init__(self, *args, **kw... | Add a model field for states of Brazil | Add a model field for states of Brazil
| Python | bsd-3-clause | zarelit/django-localflavor,rsalmaso/django-localflavor,maisim/django-localflavor,infoxchange/django-localflavor,M157q/django-localflavor,agustin380/django-localflavor,django/django-localflavor,thor/django-localflavor,jieter/django-localflavor | from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from .br_states import STATE_CHOICES
class BRStateField(CharField):
"""
A model field for states of Brazil
"""
description = _("BR. state (two uppercase letters)")
def __init__(self, *args, **kw... | Add a model field for states of Brazil
| |
d12a4d5fbaeb068e5e7544a9b9e09a9842e48bc1 | satori.core/satori/core/wsgi.py | satori.core/satori/core/wsgi.py | import sys
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'satori.core.settings')
application = get_wsgi_application()
# initialize thrift server structures - takes a long time and it's better
# to do it on startup than during the first request
import sato... | Add satori.core WSGI aplication file (belongs to 97b22ae4a25e, but forgot to add the file). | Add satori.core WSGI aplication file (belongs to 97b22ae4a25e, but forgot to add the file).
| Python | mit | zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori | import sys
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'satori.core.settings')
application = get_wsgi_application()
# initialize thrift server structures - takes a long time and it's better
# to do it on startup than during the first request
import sato... | Add satori.core WSGI aplication file (belongs to 97b22ae4a25e, but forgot to add the file).
| |
85748ff761ef1373a9828829a447c7b83db246de | coliziune/teste/generate_ok.py | coliziune/teste/generate_ok.py | from sh import cp, rm
import sh
import os
SURSA_CPP = 'main.cpp'
PROBLEMA = 'coliziune'
cp('../' + SURSA_CPP, '.')
os.system('g++ ' + SURSA_CPP)
for i in range(1, 11):
print 'Testul ', i
cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in')
os.system('./a.out')
cp(PROBLEMA + '.out', PROBLEMA + str(i) + '.ok')
for... | import subprocess
from sh import cp, rm
import sh
import os
SURSA_CPP = 'medie.cpp'
PROBLEMA = 'coliziune'
cp('../' + SURSA_CPP, '.')
os.system('g++ ' + SURSA_CPP)
for i in range(1, 11):
print 'Testul ', i
cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in')
print subprocess.check_output('time ./a.out', shell=True)... | Print time it took to run the source | Print time it took to run the source
| Python | mit | palcu/rotopcoder,palcu/rotopcoder | import subprocess
from sh import cp, rm
import sh
import os
SURSA_CPP = 'medie.cpp'
PROBLEMA = 'coliziune'
cp('../' + SURSA_CPP, '.')
os.system('g++ ' + SURSA_CPP)
for i in range(1, 11):
print 'Testul ', i
cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in')
print subprocess.check_output('time ./a.out', shell=True)... | Print time it took to run the source
from sh import cp, rm
import sh
import os
SURSA_CPP = 'main.cpp'
PROBLEMA = 'coliziune'
cp('../' + SURSA_CPP, '.')
os.system('g++ ' + SURSA_CPP)
for i in range(1, 11):
print 'Testul ', i
cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in')
os.system('./a.out')
cp(PROBLEMA + '... |
34df666a20b6dba1f84af63e640a8d1058f131a8 | exam/asserts.py | exam/asserts.py | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... | Use repr for assert failure | Use repr for assert failure
| Python | mit | Fluxx/exam,gterzian/exam,Fluxx/exam,gterzian/exam | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... | Use repr for assert failure
IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('af... |
ef294ced9a9500344e02b046a2d4dd3b9621229d | tests/t_utils/test_filters.py | tests/t_utils/test_filters.py | # -*- coding: utf-8 -*-
"""
tests.t_utils.test_filters
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by The Stormrose Project team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
import os
from unittest import TestCase
from xobox.utils import filters
class TestXoboxUtilsFi... | Add unit test for xobox.utils.filters.file | Add unit test for xobox.utils.filters.file
| Python | mit | stormrose-va/xobox | # -*- coding: utf-8 -*-
"""
tests.t_utils.test_filters
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by The Stormrose Project team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
import os
from unittest import TestCase
from xobox.utils import filters
class TestXoboxUtilsFi... | Add unit test for xobox.utils.filters.file
| |
552166a61e66f305b3729718361078558298883b | couchdb/tests/testutil.py | couchdb/tests/testutil.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import uuid
from couchdb import client
class TempDatabaseMixin(object):
temp_dbs = None
_d... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import random
import sys
from couchdb import client
class TempDatabaseMixin(object):
temp_dbs ... | Use a random number instead of uuid for temp database name. | Use a random number instead of uuid for temp database name.
| Python | bsd-3-clause | ssaavedra/couchdb-python,oliora/couchdb-python,hdmessaging/couchbase-mapping-python | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import random
import sys
from couchdb import client
class TempDatabaseMixin(object):
temp_dbs ... | Use a random number instead of uuid for temp database name.
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import uuid
from couchdb import client
... |
228ff64938268e454eb4c66db3ceaf63a4692272 | l10n_it_split_payment/migrations/14.0.1.0.0/pre-move_split_amount.py | l10n_it_split_payment/migrations/14.0.1.0.0/pre-move_split_amount.py | # Copyright 2021 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
openupgrade.add_fields(
env,
[("amount_sp", "account.move", False, "float", False, ... | Move amount_sp to account_move Otherwise the value is recomputed and the following error might occur: Impossibile aggiungere/modificare registrazioni antecedenti o pari alla data di chiusura 24/09/2020. | Move amount_sp to account_move
Otherwise the value is recomputed and the following error might occur:
Impossibile aggiungere/modificare registrazioni antecedenti o pari alla data di chiusura 24/09/2020.
| Python | agpl-3.0 | OCA/l10n-italy,OCA/l10n-italy,OCA/l10n-italy,dcorio/l10n-italy,dcorio/l10n-italy,dcorio/l10n-italy | # Copyright 2021 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
openupgrade.add_fields(
env,
[("amount_sp", "account.move", False, "float", False, ... | Move amount_sp to account_move
Otherwise the value is recomputed and the following error might occur:
Impossibile aggiungere/modificare registrazioni antecedenti o pari alla data di chiusura 24/09/2020.
| |
973c6a541deadb5a4b7c23dae191acf9d4c1be27 | buffer/tests/test_link.py | buffer/tests/test_link.py | from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.co... | from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.co... | Test link's shares retrieving using get_share method | Test link's shares retrieving using get_share method
| Python | mit | bufferapp/buffer-python,vtemian/buffpy | from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.co... | Test link's shares retrieving using get_share method
from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': ... |
f1d3d2f5543c0e847c4b2051c04837cb3586846e | emission/analysis/plotting/leaflet_osm/our_plotter.py | emission/analysis/plotting/leaflet_osm/our_plotter.py | import pandas as pd
import folium
def get_map_list(df, potential_splits):
mapList = []
potential_splits_list = list(potential_splits)
for start, end in zip(potential_splits_list, potential_splits_list[1:]):
trip = df[start:end]
currMap = folium.Map([trip.mLatitude.mean(), trip.mLongitude.me... | import pandas as pd
import folium
def df_to_string_list(df):
"""
Convert the input df into a list of strings, suitable for using as popups in a map.
This is a utility function.
"""
print "Converting df with size %s to string list" % df.shape[0]
array_list = df.as_matrix().tolist()
return [s... | Enhance our plotter to use the new div_markers code | Enhance our plotter to use the new div_markers code
And to generate popups correctly
| Python | bsd-3-clause | yw374cornell/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,joshzarrabi/e-mis... | import pandas as pd
import folium
def df_to_string_list(df):
"""
Convert the input df into a list of strings, suitable for using as popups in a map.
This is a utility function.
"""
print "Converting df with size %s to string list" % df.shape[0]
array_list = df.as_matrix().tolist()
return [s... | Enhance our plotter to use the new div_markers code
And to generate popups correctly
import pandas as pd
import folium
def get_map_list(df, potential_splits):
mapList = []
potential_splits_list = list(potential_splits)
for start, end in zip(potential_splits_list, potential_splits_list[1:]):
trip ... |
d7a031b7c701b01f646ea60966f9cab34a076db7 | tests/test_ensure_ind.py | tests/test_ensure_ind.py | # -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# Lead Developer: Feras Saad <fsaad@mit.edu>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal ... | Add test for ENSURE INDEPENDENT. Depdendent is disabled for now, pending conditional models. | Add test for ENSURE INDEPENDENT. Depdendent is disabled for now, pending conditional models.
| Python | apache-2.0 | probcomp/cgpm,probcomp/cgpm | # -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# Lead Developer: Feras Saad <fsaad@mit.edu>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal ... | Add test for ENSURE INDEPENDENT. Depdendent is disabled for now, pending conditional models.
| |
0f30fb878ae0c493eb117e0b27a33937bb90e52c | examples/use_socket.py | examples/use_socket.py | """A basic example of using hug.use.Socket to return data from raw sockets"""
import hug
import socket
import struct
import time
http_socket = hug.use.Socket(connect_to=('www.google.com', 80), proto='tcp', pool=4, timeout=10.0)
ntp_service = hug.use.Socket(connect_to=('127.0.0.1', 123), proto='udp', pool=4, timeout=1... | Add example code for using hug.use.Socket with udp and tcp | Add example code for using hug.use.Socket with udp and tcp
| Python | mit | MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug | """A basic example of using hug.use.Socket to return data from raw sockets"""
import hug
import socket
import struct
import time
http_socket = hug.use.Socket(connect_to=('www.google.com', 80), proto='tcp', pool=4, timeout=10.0)
ntp_service = hug.use.Socket(connect_to=('127.0.0.1', 123), proto='udp', pool=4, timeout=1... | Add example code for using hug.use.Socket with udp and tcp
| |
c7a73618be923f5e191e4334728b52fca1300a21 | indra/databases/mgi_client.py | indra/databases/mgi_client.py | from collections import defaultdict
from indra.util import read_unicode_csv
from indra.resources import get_resource_path
def get_id_from_name(name):
return mgi_name_to_id.get(name)
def get_name_from_id(mgi_id):
return mgi_id_to_name.get(mgi_id)
def get_synonyms(mgi_id):
return mgi_synonyms.get(mgi_i... | Add initial MGI client implementation | Add initial MGI client implementation
| Python | bsd-2-clause | bgyori/indra,sorgerlab/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,johnbachman/indra,sorgerlab/indra,johnbachman/indra,bgyori/indra | from collections import defaultdict
from indra.util import read_unicode_csv
from indra.resources import get_resource_path
def get_id_from_name(name):
return mgi_name_to_id.get(name)
def get_name_from_id(mgi_id):
return mgi_id_to_name.get(mgi_id)
def get_synonyms(mgi_id):
return mgi_synonyms.get(mgi_i... | Add initial MGI client implementation
| |
2a8a13986b29bdc405fc922143e3407c81f196c0 | timpani/settings.py | timpani/settings.py | from . import database
def getAllSettings():
databaseConnection = database.ConnectionManager.getConnection("main")
query = databaseConnection.session.query(database.tables.Setting)
settings = query.all()
return {setting.name: setting.value for setting in settings}
def getSettingValue(name):
databaseConnection = ... | from . import database
def getAllSettings():
databaseConnection = database.ConnectionManager.getConnection("main")
query = databaseConnection.session.query(database.tables.Setting)
settings = query.all()
return {setting.name: setting.value for setting in settings}
def getSettingValue(name):
databaseConnection = ... | Add setting validation function for title | Add setting validation function for title
| Python | mit | ollien/Timpani,ollien/Timpani,ollien/Timpani | from . import database
def getAllSettings():
databaseConnection = database.ConnectionManager.getConnection("main")
query = databaseConnection.session.query(database.tables.Setting)
settings = query.all()
return {setting.name: setting.value for setting in settings}
def getSettingValue(name):
databaseConnection = ... | Add setting validation function for title
from . import database
def getAllSettings():
databaseConnection = database.ConnectionManager.getConnection("main")
query = databaseConnection.session.query(database.tables.Setting)
settings = query.all()
return {setting.name: setting.value for setting in settings}
def ge... |
6054b634c79d95e5cd2a4ed5c796d8ffcd1ddcc1 | frigg/builds/migrations/0003_auto_20141029_2158.py | frigg/builds/migrations/0003_auto_20141029_2158.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('builds', '0002_auto_20141028_0710'),
]
operations = [
migrations.AlterModelOptions(
name='build',
options={'... | Add migration for ordering update | Add migration for ordering update
| Python | mit | frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('builds', '0002_auto_20141028_0710'),
]
operations = [
migrations.AlterModelOptions(
name='build',
options={'... | Add migration for ordering update
| |
9edb1098aa7a4993d801550d03399fd85450b0c0 | regscrape/regs_common/commands/mark_searchable_entities.py | regscrape/regs_common/commands/mark_searchable_entities.py | GEVENT = False
def run():
from regs_models import Entity
print "Updating entity search index..."
# mark the ones that should be searchable but aren't as searchable
Entity.objects(__raw__={
'td_type': 'organization',
'stats.count': {'$gt': 0},
'searchable': False
}).update(... | Add a tiny bit of infrastructure to make Mongo-based search work for entities. | Add a tiny bit of infrastructure to make Mongo-based search work for entities.
| Python | bsd-3-clause | sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper | GEVENT = False
def run():
from regs_models import Entity
print "Updating entity search index..."
# mark the ones that should be searchable but aren't as searchable
Entity.objects(__raw__={
'td_type': 'organization',
'stats.count': {'$gt': 0},
'searchable': False
}).update(... | Add a tiny bit of infrastructure to make Mongo-based search work for entities.
| |
8f0befc2bd6e42c544e30630a82fdcec291dfe1f | judge/telerik_academy_auth.py | judge/telerik_academy_auth.py | from django.contrib.auth.models import User
from dmoj import settings
import json
import requests
from judge.models import Profile, Language
class RemoteUserBackend (object):
def get_login_url(self, api_key, username, password):
return 'https://telerikacademy.com/Api/Users/CheckUserLogin?apiKey=%s&use... | from django.contrib.auth.models import User
from dmoj import settings
import json
import requests
from judge.models import Profile, Language
class RemoteUserBackend (object):
def get_login_url(self, api_key, username, password):
return 'https://telerikacademy.com/Api/Users/CheckUserLogin?apiKey=%s&use... | Use username provided by telerik academy auth API | Use username provided by telerik academy auth API
| Python | agpl-3.0 | Minkov/site,Minkov/site,Minkov/site,Minkov/site | from django.contrib.auth.models import User
from dmoj import settings
import json
import requests
from judge.models import Profile, Language
class RemoteUserBackend (object):
def get_login_url(self, api_key, username, password):
return 'https://telerikacademy.com/Api/Users/CheckUserLogin?apiKey=%s&use... | Use username provided by telerik academy auth API
from django.contrib.auth.models import User
from dmoj import settings
import json
import requests
from judge.models import Profile, Language
class RemoteUserBackend (object):
def get_login_url(self, api_key, username, password):
return 'https://teleri... |
84f4626a623283c3c4d98d9be0ccd69fe837f772 | download_data.py | download_data.py | #!/usr/bin/env python
from lbtoolbox.download import download
import os
import inspect
import tarfile
def here(f):
me = inspect.getsourcefile(here)
return os.path.join(os.path.dirname(os.path.abspath(me)), f)
def download_extract(url, into):
fname = download(url, into)
print("Extracting...")
w... | #!/usr/bin/env python
from lbtoolbox.download import download
import os
import inspect
import tarfile
def here(f):
me = inspect.getsourcefile(here)
return os.path.join(os.path.dirname(os.path.abspath(me)), f)
def download_extract(urlbase, name, into):
print("Downloading " + name)
fname = download(... | Update download URL and add more output to downloader. | Update download URL and add more output to downloader.
| Python | mit | lucasb-eyer/BiternionNet | #!/usr/bin/env python
from lbtoolbox.download import download
import os
import inspect
import tarfile
def here(f):
me = inspect.getsourcefile(here)
return os.path.join(os.path.dirname(os.path.abspath(me)), f)
def download_extract(urlbase, name, into):
print("Downloading " + name)
fname = download(... | Update download URL and add more output to downloader.
#!/usr/bin/env python
from lbtoolbox.download import download
import os
import inspect
import tarfile
def here(f):
me = inspect.getsourcefile(here)
return os.path.join(os.path.dirname(os.path.abspath(me)), f)
def download_extract(url, into):
fnam... |
90506789edab1afb58ecebb90218f2654498a754 | regserver/regserver/urls.py | regserver/regserver/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
url(r'', include('regulations.urls')),
url(r'^eregulations/', include('regulations.urls')),
)
| from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
url(r'', include('regulations.urls')),
)
| Remove eregulations url as reversing is not consistent | Remove eregulations url as reversing is not consistent
| Python | cc0-1.0 | 18F/regulations-site,adderall/regulations-site,eregs/regulations-site,EricSchles/regulations-site,grapesmoker/regulations-site,tadhg-ohiggins/regulations-site,ascott1/regulations-site,jeremiak/regulations-site,ascott1/regulations-site,willbarton/regulations-site,EricSchles/regulations-site,jeremiak/regulations-site,gra... | from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
url(r'', include('regulations.urls')),
)
| Remove eregulations url as reversing is not consistent
from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
url(r'', include('regulations.urls')),
url(r'^eregulations/', include('regulations.urls')),
)
|
aed959a0593558b6063e70c3b594feb6caa4bdda | tests/runner/compose/init_test.py | tests/runner/compose/init_test.py | import os
import tempfile
import shutil
from unittest import TestCase
import yaml
from dusty import constants
from dusty.runner.compose import _write_composefile
class TestComposeRunner(TestCase):
def setUp(self):
self.temp_compose_dir = tempfile.mkdtemp()
self.temp_compose_path = os.path.join(se... | import os
import tempfile
import shutil
from unittest import TestCase
from mock import patch
import yaml
from dusty import constants
from dusty.runner.compose import _write_composefile, _get_docker_env
class TestComposeRunner(TestCase):
def setUp(self):
self.temp_compose_dir = tempfile.mkdtemp()
... | Add a test for _get_docker_env | Add a test for _get_docker_env
| Python | mit | gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty | import os
import tempfile
import shutil
from unittest import TestCase
from mock import patch
import yaml
from dusty import constants
from dusty.runner.compose import _write_composefile, _get_docker_env
class TestComposeRunner(TestCase):
def setUp(self):
self.temp_compose_dir = tempfile.mkdtemp()
... | Add a test for _get_docker_env
import os
import tempfile
import shutil
from unittest import TestCase
import yaml
from dusty import constants
from dusty.runner.compose import _write_composefile
class TestComposeRunner(TestCase):
def setUp(self):
self.temp_compose_dir = tempfile.mkdtemp()
self.tem... |
b06d6acf77c1894a1fbe1c92b8f46af1d9f4dfb3 | tool/greedy_test.py | tool/greedy_test.py | #!/usr/bin/env python
#
# This script tests the functions in GreedyEmbedding. It also shows
# how to calculate the distance of any two points in Poincare disk.
#
# Reference:
# R. Kleinberg - Geographic routing using hyperbolic space
# A. Cvetkovski - Hyperbolic Embedding and Routing for Dynamic Graphs
#
# Liang Wang... | Add test module for GreedyEmbedding | Add test module for GreedyEmbedding
| Python | lgpl-2.1 | ryanrhymes/mobiccnx,ryanrhymes/mobiccnx,ryanrhymes/mobiccnx,ryanrhymes/mobiccnx,ryanrhymes/mobiccnx,ryanrhymes/mobiccnx | #!/usr/bin/env python
#
# This script tests the functions in GreedyEmbedding. It also shows
# how to calculate the distance of any two points in Poincare disk.
#
# Reference:
# R. Kleinberg - Geographic routing using hyperbolic space
# A. Cvetkovski - Hyperbolic Embedding and Routing for Dynamic Graphs
#
# Liang Wang... | Add test module for GreedyEmbedding
| |
d57fab92485e403dd24321ded7090b9c46d61655 | send_packet.py | send_packet.py | from socket import *
def send_packet(src, dst, eth_type, payload, interface = "eth0"):
"""Send raw Ethernet packet on interface."""
assert(len(src) == len(dst) == 6) # 48-bit ethernet addresses
assert(len(eth_type) == 2) # 16-bit ethernet type
s = socket(AF_PACKET, SOCK_RAW)
# From the docs: "For raw pack... | Add sending raw packet example | Add sending raw packet example | Python | mit | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | from socket import *
def send_packet(src, dst, eth_type, payload, interface = "eth0"):
"""Send raw Ethernet packet on interface."""
assert(len(src) == len(dst) == 6) # 48-bit ethernet addresses
assert(len(eth_type) == 2) # 16-bit ethernet type
s = socket(AF_PACKET, SOCK_RAW)
# From the docs: "For raw pack... | Add sending raw packet example
| |
50e438eeaca4910f1d1938acd7c8b02eb18bfc71 | setup.py | setup.py | import ez_setup
ez_setup.use_setuptools()
from setuptools import setup
# TODO: setup crontab entry on install
setup(
name='plex-tvst-sync',
version='0.1.0',
author='sprt',
author_email='hellosprt@gmail.com',
url='https://github.com/sprt/plex-tvst-sync',
install_requires=[
'PlexAPI==1.... | import ez_setup
ez_setup.use_setuptools()
from distutils.command.install import install
from setuptools import setup
from setuptools import Command
class CustomInstall(install):
def _setup_cron(self):
import crontab
cron = crontab.CronTab(user=True)
job = cron.new(command='plex-t... | Add a crontab entry on install | Add a crontab entry on install
| Python | mit | sprt/plex-tvst-sync | import ez_setup
ez_setup.use_setuptools()
from distutils.command.install import install
from setuptools import setup
from setuptools import Command
class CustomInstall(install):
def _setup_cron(self):
import crontab
cron = crontab.CronTab(user=True)
job = cron.new(command='plex-t... | Add a crontab entry on install
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup
# TODO: setup crontab entry on install
setup(
name='plex-tvst-sync',
version='0.1.0',
author='sprt',
author_email='hellosprt@gmail.com',
url='https://github.com/sprt/plex-tvst-sync',
install... |
17ddd05e35f7cff90530cdb2df0c4971b97e7302 | cmcb/utils.py | cmcb/utils.py | import sys
from functools import wraps, _make_key
import redis
def logging(*triggers, out=sys.stdout):
"""Will log function if all triggers are True"""
log = min(triggers) # will be False if any trigger is false
def wrapper(function):
@wraps(function)
def wrapped_function(*args, **kwarg... | import sys
import inspect
from functools import wraps, _make_key
import redis
def logging(*triggers, out=sys.stdout):
"""Will log function if all triggers are True"""
log = min(triggers) # will be False if any trigger is false
def wrapper(function):
@wraps(function)
def wrapped_function... | Update logging to log async functions properly | Update logging to log async functions properly
| Python | mit | festinuz/cmcb,festinuz/cmcb | import sys
import inspect
from functools import wraps, _make_key
import redis
def logging(*triggers, out=sys.stdout):
"""Will log function if all triggers are True"""
log = min(triggers) # will be False if any trigger is false
def wrapper(function):
@wraps(function)
def wrapped_function... | Update logging to log async functions properly
import sys
from functools import wraps, _make_key
import redis
def logging(*triggers, out=sys.stdout):
"""Will log function if all triggers are True"""
log = min(triggers) # will be False if any trigger is false
def wrapper(function):
@wraps(funct... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.