Merge pull request #7 from chfw/dev

release 0.0.5
This commit is contained in:
jaska 2018-11-06 18:38:14 +00:00 committed by GitHub
commit 8d1af6e0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 753 additions and 677 deletions

10
.isort.cfg Normal file
View File

@ -0,0 +1,10 @@
[settings]
line_length=79
known_first_party=
known_third_party=mock,nose
indent=' '
multi_line_output=3
length_sort=1
default_section=FIRSTPARTY
no_lines_before=LOCALFOLDER
sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER

View File

@ -10,7 +10,7 @@
{%endif%} {%endif%}
{%endif%} {%endif%}
pip freeze pip freeze
nosetests --with-cov --cover-package {{package|lower}} --cover-package tests {%if not exclude_doctest%}--with-doctest --doctest-extension=.rst README.rst{%endif%} tests {%if not nodocs%}docs/source{%endif%} {%if not external_module_library%}{{package|lower}}{%endif%} && flake8 . --exclude=.moban.d {%block flake8_options%}--builtins=unicode,xrange,long{%endblock%} nosetests --with-cov --cover-package {{package|lower}} --cover-package tests {%if not exclude_doctest%}--with-doctest --doctest-extension=.rst README.rst{%endif%} tests {%if not nodocs%}docs/source{%endif%} {%if not external_module_library%}{{package|lower}}{%endif%} && flake8 . --exclude=.moban.d,docs {%block flake8_options%}--builtins=unicode,xrange,long{%endblock%}
{%block posttest%} {%block posttest%}
{%endblock%} {%endblock%}

View File

@ -1,6 +1,10 @@
requires:
- type: git
url: https://github.com/moremoban/pypi-mobans
submodule: true
configuration: configuration:
template_dir: template_dir:
- "setupmobans/templates" - "pypi-mobans:templates"
- ".moban.d" - ".moban.d"
configuration: lml.yml configuration: lml.yml
targets: targets:

View File

@ -3,10 +3,10 @@ language: python
notifications: notifications:
email: false email: false
python: python:
- 3.7-dev
- 3.6 - 3.6
- 3.5 - 3.5
- 3.4 - 3.4
- 3.3
- 2.7 - 2.7
- pypy - pypy
before_install: before_install:

View File

@ -1,6 +1,15 @@
Change log Change log
================================================================================ ================================================================================
0.0.5 - 06/11/2018
--------------------------------------------------------------------------------
Fixed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. `#6 <https://github.com/chfw/lml/issues/6>`_: Catch and Ignore
ModuleNotFoundError
0.0.4 - 07.08.2018 0.0.4 - 07.08.2018
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -12,3 +12,9 @@ spelling:
uml: uml:
plantuml -tsvg -o ../_static/images/ docs/source/uml/*.uml plantuml -tsvg -o ../_static/images/ docs/source/uml/*.uml
format:
isort -y $(find lml -name "*.py"|xargs echo) $(find tests -name "*.py"|xargs echo)
black -l 79 lml
black -l 79 tests
black -l 79 examples

View File

@ -1,11 +1,17 @@
name: lml name: lml
organisation: chfw organisation: chfw
releases: releases:
- changes:
- action: Fixed
details:
- "`#6`: Catch and Ignore ModuleNotFoundError"
date: 06/11/2018
version: 0.0.5
- changes: - changes:
- action: Added - action: Added
details: details:
- "`#4`: to find plugin names with different naming patterns" - "`#4`: to find plugin names with different naming patterns"
date: 07.08.2018 date: 07.08.2018
version: 0.0.4 version: 0.0.4
- changes: - changes:
- action: Added - action: Added

View File

@ -28,9 +28,9 @@ copyright = u'2017-2018 Onni Software Ltd.'
author = u'C.W.' author = u'C.W.'
# The short X.Y version # The short X.Y version
version = u'0.0.4' version = u'0.0.5'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = u'0.0.4' release = u'0.0.5'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
@ -42,12 +42,7 @@ release = u'0.0.4'
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode',]
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
@ -74,7 +69,7 @@ language = 'en'
exclude_patterns = [] exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' pygments_style = None
# -- Options for HTML output ------------------------------------------------- # -- Options for HTML output -------------------------------------------------
@ -162,6 +157,24 @@ texinfo_documents = [
'Miscellaneous'), 'Miscellaneous'),
] ]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration ------------------------------------------------- # -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension --------------------------------------- # -- Options for intersphinx extension ---------------------------------------

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "Sample project to demonstrate load me later plugin system" + ""
'Sample project to demonstrate load me later plugin system' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef' project = u"robotchef"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchefdoc' htmlhelp_basename = "robotchefdoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef.tex', (
'robotchef Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef.tex",
"robotchef Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef', (
'robotchef Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef",
"robotchef Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef', (
'robotchef Documentation', "index",
'Onni Software Ltd.', 'robotchef', "robotchef",
DESCRIPTION, "robotchef Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -1,16 +1,17 @@
import sys import sys
from lml.loader import scan_plugins
from robotchef.plugin import CuisineManager, NoChefException
import logging import logging
import logging.config import logging.config
logging.basicConfig( from robotchef.plugin import CuisineManager, NoChefException
format='%(name)s:%(lineno)d - %(levelname)s - %(message)s',
level=logging.DEBUG)
BUILTINS = ['robotchef.robot_cuisine'] from lml.loader import scan_plugins
logging.basicConfig(
format="%(name)s:%(lineno)d - %(levelname)s - %(message)s",
level=logging.DEBUG,
)
BUILTINS = ["robotchef.robot_cuisine"]
def main(): def main():
@ -18,7 +19,7 @@ def main():
sys.exit(-1) sys.exit(-1)
cuisine_manager = CuisineManager() cuisine_manager = CuisineManager()
scan_plugins("robotchef_", 'robotchef', white_list=BUILTINS) scan_plugins("robotchef_", "robotchef", white_list=BUILTINS)
food_name = sys.argv[1] food_name = sys.argv[1]
try: try:

View File

@ -17,6 +17,5 @@ class CuisineManager(PluginManager):
class Chef(object): class Chef(object):
def make(self, **params): def make(self, **params):
print("I am a chef") print("I am a chef")

View File

@ -2,7 +2,5 @@ from lml.plugin import PluginInfoChain
PluginInfoChain(__name__).add_a_plugin( PluginInfoChain(__name__).add_a_plugin(
'cuisine', "cuisine", "electrify.Boost", tags=["Portable Battery"]
'electrify.Boost',
tags=['Portable Battery']
) )

View File

@ -2,6 +2,5 @@ from robotchef.plugin import Chef
class Boost(Chef): class Boost(Chef):
def make(self, food=None, **keywords): def make(self, food=None, **keywords):
print("I can cook %s for robots" % food) print("I can cook %s for robots" % food)

View File

@ -2,47 +2,38 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef' NAME = "robotchef"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc (c) hotmail.com' EMAIL = "wangc (c) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
ENTRY_POINTS = { ENTRY_POINTS = {"console_scripts": ["robotchef = robotchef.main:main"]}
'console_scripts': [ DESCRIPTION = "Sample project to demonstrate load me later plugin system" + ""
'robotchef = robotchef.main:main' KEYWORDS = []
]
}
DESCRIPTION = (
'Sample project to demonstrate load me later plugin system' +
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = ["lml"]
'lml',
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = { EXTRAS_REQUIRE = {}
}
def read_files(*files): def read_files(*files):
@ -56,7 +47,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -65,11 +56,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -82,22 +73,22 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
entry_points=ENTRY_POINTS, entry_points=ENTRY_POINTS,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,6 +1,8 @@
import sys import sys
from mock import patch from mock import patch
from nose.tools import eq_ from nose.tools import eq_
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
if PY2: if PY2:
@ -9,10 +11,11 @@ else:
from io import StringIO from io import StringIO
@patch('sys.stdout', new_callable=StringIO) @patch("sys.stdout", new_callable=StringIO)
def test_peking_duck(stdout): def test_peking_duck(stdout):
arguments = ['robotchef', 'Peking Duck'] arguments = ["robotchef", "Peking Duck"]
from robotchef.main import main from robotchef.main import main
with patch.object(sys, 'argv', arguments):
with patch.object(sys, "argv", arguments):
main() main()
eq_(stdout.getvalue(), 'I can roast Peking Duck\n') eq_(stdout.getvalue(), "I can roast Peking Duck\n")

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "It does cooking" + ""
'It does cooking' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_allinone' project = u"robotchef_allinone"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_allinonedoc' htmlhelp_basename = "robotchef_allinonedoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_allinone.tex', (
'robotchef_allinone Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_allinone.tex",
"robotchef_allinone Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_allinone', (
'robotchef_allinone Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_allinone",
"robotchef_allinone Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_allinone', (
'robotchef_allinone Documentation', "index",
'Onni Software Ltd.', 'robotchef_allinone', "robotchef_allinone",
DESCRIPTION, "robotchef_allinone Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_allinone",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -3,25 +3,21 @@ class NoChefException(Exception):
class Chef(object): class Chef(object):
def make(self, **params): def make(self, **params):
print("I am a chef") print("I am a chef")
class Boost(Chef): class Boost(Chef):
def make(self, food=None, **keywords): def make(self, food=None, **keywords):
print("I can cook %s for robots" % food) print("I can cook %s for robots" % food)
class Fry(Chef): class Fry(Chef):
def make(self, food=None): def make(self, food=None):
print("I can fry " + food) print("I can fry " + food)
class Bake(Chef): class Bake(Chef):
def make(self, food=None): def make(self, food=None):
print("I can bake " + food) print("I can bake " + food)
@ -30,7 +26,7 @@ PLUGINS = {
"Portable Battery": Boost, "Portable Battery": Boost,
"Fish and Chips": Fry, "Fish and Chips": Fry,
"Cornish Scone": Bake, "Cornish Scone": Bake,
"Jacket Potato": Bake "Jacket Potato": Bake,
} }

View File

@ -2,44 +2,39 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_allinone' NAME = "robotchef_allinone"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (at) hotmail.com' EMAIL = "wangc_2011 (at) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
ENTRY_POINTS = { ENTRY_POINTS = {
'console_scripts': [ "console_scripts": ["robotchef_allinone = robotchef_allinone.main:main"]
'robotchef_allinone = robotchef_allinone.main:main'
]
} }
DESCRIPTION = ( DESCRIPTION = "It does cooking" + ""
'It does cooking' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -54,7 +49,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -63,11 +58,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -80,22 +75,22 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
entry_points=ENTRY_POINTS, entry_points=ENTRY_POINTS,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,6 +1,8 @@
import sys import sys
from mock import patch from mock import patch
from nose.tools import eq_ from nose.tools import eq_
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
if PY2: if PY2:
@ -9,10 +11,11 @@ else:
from io import StringIO from io import StringIO
@patch('sys.stdout', new_callable=StringIO) @patch("sys.stdout", new_callable=StringIO)
def test_cornish_scone(stdout): def test_cornish_scone(stdout):
arguments = ['robotchef', 'Cornish Scone'] arguments = ["robotchef", "Cornish Scone"]
from robotchef_allinone.main import main from robotchef_allinone.main import main
with patch.object(sys, 'argv', arguments):
with patch.object(sys, "argv", arguments):
main() main()
eq_(stdout.getvalue(), 'I can bake Cornish Scone\n') eq_(stdout.getvalue(), "I can bake Cornish Scone\n")

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "it cook food" + ""
'it cook food' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_allinone_lml' project = u"robotchef_allinone_lml"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_allinone_lmldoc' htmlhelp_basename = "robotchef_allinone_lmldoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_allinone_lml.tex', (
'robotchef_allinone_lml Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_allinone_lml.tex",
"robotchef_allinone_lml Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_allinone_lml', (
'robotchef_allinone_lml Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_allinone_lml",
"robotchef_allinone_lml Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_allinone_lml', (
'robotchef_allinone_lml Documentation', "index",
'Onni Software Ltd.', 'robotchef_allinone_lml', "robotchef_allinone_lml",
DESCRIPTION, "robotchef_allinone_lml Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_allinone_lml",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -1,4 +1,4 @@
from lml.plugin import PluginManager, PluginInfo from lml.plugin import PluginInfo, PluginManager
class NoChefException(Exception): class NoChefException(Exception):
@ -17,27 +17,23 @@ class CuisineManager(PluginManager):
class Chef(object): class Chef(object):
def make(self, **params): def make(self, **params):
print("I am a chef") print("I am a chef")
@PluginInfo('cuisine', tags=['Portable Battery']) @PluginInfo("cuisine", tags=["Portable Battery"])
class Boost(Chef): class Boost(Chef):
def make(self, food=None, **keywords): def make(self, food=None, **keywords):
print("I can cook %s for robots" % food) print("I can cook %s for robots" % food)
@PluginInfo('cuisine', tags=['Fish and Chips']) @PluginInfo("cuisine", tags=["Fish and Chips"])
class Fry(Chef): class Fry(Chef):
def make(self, food=None): def make(self, food=None):
print("I can fry " + food) print("I can fry " + food)
@PluginInfo('cuisine', tags=['Cornish Scone', 'Jacket Potato']) @PluginInfo("cuisine", tags=["Cornish Scone", "Jacket Potato"])
class Bake(Chef): class Bake(Chef):
def make(self, food=None): def make(self, food=None):
print("I can bake " + food) print("I can bake " + food)

View File

@ -2,44 +2,41 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_allinone_lml' NAME = "robotchef_allinone_lml"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (at) hotmail.com' EMAIL = "wangc_2011 (at) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
ENTRY_POINTS = { ENTRY_POINTS = {
'console_scripts': [ "console_scripts": [
'robotchef_allinone_lml = robotchef_allinone_lml.main:main' "robotchef_allinone_lml = robotchef_allinone_lml.main:main"
] ]
} }
DESCRIPTION = ( DESCRIPTION = "it cook food" + ""
'it cook food' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -54,7 +51,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -63,11 +60,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -80,22 +77,22 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
entry_points=ENTRY_POINTS, entry_points=ENTRY_POINTS,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,6 +1,8 @@
import sys import sys
from mock import patch from mock import patch
from nose.tools import eq_ from nose.tools import eq_
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
if PY2: if PY2:
@ -9,10 +11,11 @@ else:
from io import StringIO from io import StringIO
@patch('sys.stdout', new_callable=StringIO) @patch("sys.stdout", new_callable=StringIO)
def test_cornish_scone(stdout): def test_cornish_scone(stdout):
arguments = ['robotchef', 'Cornish Scone'] arguments = ["robotchef", "Cornish Scone"]
from robotchef_allinone_lml.main import main from robotchef_allinone_lml.main import main
with patch.object(sys, 'argv', arguments):
with patch.object(sys, "argv", arguments):
main() main()
eq_(stdout.getvalue(), 'I can bake Cornish Scone\n') eq_(stdout.getvalue(), "I can bake Cornish Scone\n")

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "Cook food in british cuisine." + ""
'Cook food in british cuisine.' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_britishcuisine' project = u"robotchef_britishcuisine"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_britishcuisinedoc' htmlhelp_basename = "robotchef_britishcuisinedoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_britishcuisine.tex', (
'robotchef_britishcuisine Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_britishcuisine.tex",
"robotchef_britishcuisine Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_britishcuisine', (
'robotchef_britishcuisine Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_britishcuisine",
"robotchef_britishcuisine Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_britishcuisine', (
'robotchef_britishcuisine Documentation', "index",
'Onni Software Ltd.', 'robotchef_britishcuisine', "robotchef_britishcuisine",
DESCRIPTION, "robotchef_britishcuisine Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_britishcuisine",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -2,11 +2,5 @@ from lml.plugin import PluginInfoChain
PluginInfoChain(__name__).add_a_plugin( PluginInfoChain(__name__).add_a_plugin(
'cuisine', "cuisine", "fry.Fry", tags=["Fish and Chips"]
'fry.Fry', ).add_a_plugin("cuisine", "bake.Bake", tags=["Cornish Scone", "Jacket Potato"])
tags=['Fish and Chips']
).add_a_plugin(
'cuisine',
'bake.Bake',
tags=['Cornish Scone', 'Jacket Potato']
)

View File

@ -2,6 +2,5 @@ from robotchef.plugin import Chef
class Bake(Chef): class Bake(Chef):
def make(self, food=None): def make(self, food=None):
print("I can bake " + food) print("I can bake " + food)

View File

@ -2,6 +2,5 @@ from robotchef.plugin import Chef
class Fry(Chef): class Fry(Chef):
def make(self, food=None): def make(self, food=None):
print("I can fry " + food) print("I can fry " + food)

View File

@ -2,39 +2,36 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_britishcuisine' NAME = "robotchef_britishcuisine"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (c) hotmail.com' EMAIL = "wangc_2011 (c) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
DESCRIPTION = ( DESCRIPTION = "Cook food in british cuisine." + ""
'Cook food in british cuisine.' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -49,7 +46,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -58,11 +55,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -75,21 +72,21 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "It cooks Chinese food" + ""
'It cooks Chinese food' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_chinesecuisine' project = u"robotchef_chinesecuisine"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_chinesecuisinedoc' htmlhelp_basename = "robotchef_chinesecuisinedoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_chinesecuisine.tex', (
'robotchef_chinesecuisine Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_chinesecuisine.tex",
"robotchef_chinesecuisine Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_chinesecuisine', (
'robotchef_chinesecuisine Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_chinesecuisine",
"robotchef_chinesecuisine Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_chinesecuisine', (
'robotchef_chinesecuisine Documentation', "index",
'Onni Software Ltd.', 'robotchef_chinesecuisine', "robotchef_chinesecuisine",
DESCRIPTION, "robotchef_chinesecuisine Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_chinesecuisine",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -2,7 +2,5 @@ from lml.plugin import PluginInfoChain
PluginInfoChain(__name__).add_a_plugin( PluginInfoChain(__name__).add_a_plugin(
'cuisine', "cuisine", "roast.Roast", tags=["Peking Duck"]
'roast.Roast',
tags=['Peking Duck']
) )

View File

@ -2,6 +2,5 @@ from robotchef.plugin import Chef
class Roast(Chef): class Roast(Chef):
def make(self, food=None): def make(self, food=None):
print("I can roast " + food) print("I can roast " + food)

View File

@ -2,39 +2,36 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_chinesecuisine' NAME = "robotchef_chinesecuisine"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (c) hotmail.com' EMAIL = "wangc_2011 (c) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
DESCRIPTION = ( DESCRIPTION = "It cooks Chinese food" + ""
'It cooks Chinese food' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -49,7 +46,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -58,11 +55,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -75,21 +72,21 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "Make robot chef to cook" + ""
'Make robot chef to cook' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_cook' project = u"robotchef_cook"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_cookdoc' htmlhelp_basename = "robotchef_cookdoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_cook.tex', (
'robotchef_cook Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_cook.tex",
"robotchef_cook Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_cook', (
'robotchef_cook Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_cook",
"robotchef_cook Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_cook', (
'robotchef_cook Documentation', "index",
'Onni Software Ltd.', 'robotchef_cook', "robotchef_cook",
DESCRIPTION, "robotchef_cook Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_cook",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -1,8 +1,4 @@
from lml.plugin import PluginInfoChain from lml.plugin import PluginInfoChain
PluginInfoChain(__name__).add_a_plugin( PluginInfoChain(__name__).add_a_plugin("cuisine", "cook.Cook", tags=["bread"])
'cuisine',
'cook.Cook',
tags=['bread']
)

View File

@ -2,6 +2,5 @@ from robotchef.plugin import Chef
class Cook(Chef): class Cook(Chef):
def make(self, food=None): def make(self, food=None):
print("I can cook " + food) print("I can cook " + food)

View File

@ -2,39 +2,36 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_cook' NAME = "robotchef_cook"
AUTHOR = 'C.W' AUTHOR = "C.W"
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (at) hotmail.com' EMAIL = "wangc_2011 (at) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
DESCRIPTION = ( DESCRIPTION = "Make robot chef to cook" + ""
'Make robot chef to cook' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -49,7 +46,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -58,11 +55,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -75,21 +72,21 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "It provide the cusine knowledge to any library" + ""
'It provide the cusine knowledge to any library' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_api' project = u"robotchef_api"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_apidoc' htmlhelp_basename = "robotchef_apidoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_api.tex', (
'robotchef_api Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_api.tex",
"robotchef_api Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_api', (
'robotchef_api Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_api",
"robotchef_api Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_api', (
'robotchef_api Documentation', "index",
'Onni Software Ltd.', 'robotchef_api', "robotchef_api",
DESCRIPTION, "robotchef_api Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_api",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -1,9 +1,9 @@
from lml.loader import scan_plugins from lml.loader import scan_plugins
from robotchef_api.plugin import CuisineManager, NoChefException # flake8: noqa from robotchef_api.plugin import CuisineManager, NoChefException # noqa: F401
BUILTINS = ['robotchef_api.robot_cuisine'] BUILTINS = ["robotchef_api.robot_cuisine"]
scan_plugins("robotchef_", __path__, white_list=BUILTINS) scan_plugins("robotchef_", __path__, white_list=BUILTINS) # noqa: F821
cuisine_manager = CuisineManager() cuisine_manager = CuisineManager()

View File

@ -17,6 +17,5 @@ class CuisineManager(PluginManager):
class Chef(object): class Chef(object):
def make(self, **params): def make(self, **params):
print(self.name) print(self.name)

View File

@ -2,7 +2,5 @@ from lml.plugin import PluginInfoChain
PluginInfoChain(__name__).add_a_plugin( PluginInfoChain(__name__).add_a_plugin(
'cuisine', "cuisine", "electricity.Boost", tags=["Portable Battery"]
'electricity.Boost',
tags=['Portable Battery']
) )

View File

@ -2,6 +2,5 @@ from robotchef_api.plugin import Chef
class Boost(Chef): class Boost(Chef):
def make(self, food=None, **keywords): def make(self, food=None, **keywords):
print("I can cook %s for robots" % food) print("I can cook %s for robots" % food)

View File

@ -2,42 +2,37 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_api' NAME = "robotchef_api"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (at) hotmail.com' EMAIL = "wangc_2011 (at) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
DESCRIPTION = ( DESCRIPTION = "It provide the cusine knowledge to any library" + ""
'It provide the cusine knowledge to any library' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = ["lml"]
'lml',
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = { EXTRAS_REQUIRE = {}
}
def read_files(*files): def read_files(*files):
@ -51,7 +46,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -60,11 +55,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -77,21 +72,21 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "Cook food in british cuisine." + ""
'Cook food in british cuisine.' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_britishcuisine' project = u"robotchef_britishcuisine"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_britishcuisinedoc' htmlhelp_basename = "robotchef_britishcuisinedoc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_britishcuisine.tex', (
'robotchef_britishcuisine Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_britishcuisine.tex",
"robotchef_britishcuisine Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_britishcuisine', (
'robotchef_britishcuisine Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_britishcuisine",
"robotchef_britishcuisine Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_britishcuisine', (
'robotchef_britishcuisine Documentation', "index",
'Onni Software Ltd.', 'robotchef_britishcuisine', "robotchef_britishcuisine",
DESCRIPTION, "robotchef_britishcuisine Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_britishcuisine",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -2,11 +2,5 @@ from lml.plugin import PluginInfoChain
PluginInfoChain(__name__).add_a_plugin( PluginInfoChain(__name__).add_a_plugin(
'cuisine', "cuisine", "fry.Fry", tags=["Fish and Chips"]
'fry.Fry', ).add_a_plugin("cuisine", "bake.Bake", tags=["Cornish Scone", "Jacket Potato"])
tags=['Fish and Chips']
).add_a_plugin(
'cuisine',
'bake.Bake',
tags=['Cornish Scone', 'Jacket Potato']
)

View File

@ -2,6 +2,5 @@ from robotchef_api.plugin import Chef
class Bake(Chef): class Bake(Chef):
def make(self, food=None): def make(self, food=None):
print("I can bake " + food) print("I can bake " + food)

View File

@ -2,6 +2,5 @@ from robotchef_api.plugin import Chef
class Fry(Chef): class Fry(Chef):
def make(self, food=None): def make(self, food=None):
print("I can fry " + food) print("I can fry " + food)

View File

@ -2,39 +2,36 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_britishcuisine' NAME = "robotchef_britishcuisine"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (c) hotmail.com' EMAIL = "wangc_2011 (c) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
DESCRIPTION = ( DESCRIPTION = "Cook food in british cuisine." + ""
'Cook food in british cuisine.' + KEYWORDS = []
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -49,7 +46,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -58,11 +55,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -75,21 +72,21 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,43 +1,52 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
DESCRIPTION = ( DESCRIPTION = "It understands world cuisine" + ""
'It understands world cuisine' +
''
)
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.doctest', "sphinx.ext.doctest",
'sphinx.ext.intersphinx', "sphinx.ext.intersphinx",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
templates_path = ['_templates'] templates_path = ["_templates"]
source_suffix = '.rst' source_suffix = ".rst"
master_doc = 'index' master_doc = "index"
project = u'robotchef_v2' project = u"robotchef_v2"
copyright = u'2017 Onni Software Ltd.' copyright = u"2017 Onni Software Ltd."
version = '0.0.1' version = "0.0.1"
release = '0.0.1' release = "0.0.1"
exclude_patterns = [] exclude_patterns = []
pygments_style = 'sphinx' pygments_style = "sphinx"
html_theme = 'default' html_theme = "default"
html_static_path = ['_static'] html_static_path = ["_static"]
htmlhelp_basename = 'robotchef_v2doc' htmlhelp_basename = "robotchef_v2doc"
latex_elements = {} latex_elements = {}
latex_documents = [ latex_documents = [
('index', 'robotchef_v2.tex', (
'robotchef_v2 Documentation', "index",
'Onni Software Ltd.', 'manual'), "robotchef_v2.tex",
"robotchef_v2 Documentation",
"Onni Software Ltd.",
"manual",
)
] ]
man_pages = [ man_pages = [
('index', 'robotchef_v2', (
'robotchef_v2 Documentation', "index",
[u'Onni Software Ltd.'], 1) "robotchef_v2",
"robotchef_v2 Documentation",
[u"Onni Software Ltd."],
1,
)
] ]
texinfo_documents = [ texinfo_documents = [
('index', 'robotchef_v2', (
'robotchef_v2 Documentation', "index",
'Onni Software Ltd.', 'robotchef_v2', "robotchef_v2",
DESCRIPTION, "robotchef_v2 Documentation",
'Miscellaneous'), "Onni Software Ltd.",
"robotchef_v2",
DESCRIPTION,
"Miscellaneous",
)
] ]

View File

@ -1,6 +1,6 @@
import sys import sys
from robotchef_api import cuisine_manager, NoChefException from robotchef_api import NoChefException, cuisine_manager
def main(): def main():

View File

@ -2,44 +2,37 @@ try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
except ImportError: except ImportError:
from ez_setup import use_setuptools from ez_setup import use_setuptools
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys import sys
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7 PY26 = PY2 and sys.version_info[1] < 7
NAME = 'robotchef_v2' NAME = "robotchef_v2"
AUTHOR = 'C.W.' AUTHOR = "C.W."
VERSION = '0.0.1' VERSION = "0.0.1"
EMAIL = 'wangc_2011 (at) hotmail.com' EMAIL = "wangc_2011 (at) hotmail.com"
LICENSE = 'MIT' LICENSE = "MIT"
ENTRY_POINTS = { ENTRY_POINTS = {"console_scripts": ["robotchef_v2 = robotchef_v2.main:main"]}
'console_scripts': [ DESCRIPTION = "It understands world cuisine" + ""
'robotchef_v2 = robotchef_v2.main:main' KEYWORDS = []
]
}
DESCRIPTION = (
'It understands world cuisine' +
''
)
KEYWORDS = [
]
CLASSIFIERS = [ CLASSIFIERS = [
'Programming Language :: Python', "Programming Language :: Python",
'Programming Language :: Python :: 2.6', "Programming Language :: Python :: 2.6",
'Programming Language :: Python :: 2.7', "Programming Language :: Python :: 2.7",
'Programming Language :: Python :: 3.3', "Programming Language :: Python :: 3.3",
'Programming Language :: Python :: 3.4', "Programming Language :: Python :: 3.4",
'Programming Language :: Python :: 3.5', "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: 3.6', "Programming Language :: Python :: 3.6",
] ]
INSTALL_REQUIRES = [ INSTALL_REQUIRES = []
]
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
EXTRAS_REQUIRE = {} EXTRAS_REQUIRE = {}
@ -54,7 +47,7 @@ def read_files(*files):
def read(afile): def read(afile):
"""Read a file into setup""" """Read a file into setup"""
with open(afile, 'r') as opened_file: with open(afile, "r") as opened_file:
content = filter_out_test_code(opened_file) content = filter_out_test_code(opened_file)
content = "".join(list(content)) content = "".join(list(content))
return content return content
@ -63,11 +56,11 @@ def read(afile):
def filter_out_test_code(file_handle): def filter_out_test_code(file_handle):
found_test_code = False found_test_code = False
for line in file_handle.readlines(): for line in file_handle.readlines():
if line.startswith('.. testcode:'): if line.startswith(".. testcode:"):
found_test_code = True found_test_code = True
continue continue
if found_test_code is True: if found_test_code is True:
if line.startswith(' '): if line.startswith(" "):
continue continue
else: else:
empty_line = line.strip() empty_line = line.strip()
@ -80,22 +73,22 @@ def filter_out_test_code(file_handle):
yield line yield line
if __name__ == '__main__': if __name__ == "__main__":
setup( setup(
name=NAME, name=NAME,
author=AUTHOR, author=AUTHOR,
version=VERSION, version=VERSION,
author_email=EMAIL, author_email=EMAIL,
description=DESCRIPTION, description=DESCRIPTION,
long_description=read_files('README.rst', 'CHANGELOG.rst'), long_description=read_files("README.rst", "CHANGELOG.rst"),
license=LICENSE, license=LICENSE,
keywords=KEYWORDS, keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
tests_require=['nose'], tests_require=["nose"],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
packages=PACKAGES, packages=PACKAGES,
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
entry_points=ENTRY_POINTS, entry_points=ENTRY_POINTS,
classifiers=CLASSIFIERS classifiers=CLASSIFIERS,
) )

View File

@ -1,6 +1,8 @@
import sys import sys
from mock import patch from mock import patch
from nose.tools import eq_ from nose.tools import eq_
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
if PY2: if PY2:
@ -9,10 +11,11 @@ else:
from io import StringIO from io import StringIO
@patch('sys.stdout', new_callable=StringIO) @patch("sys.stdout", new_callable=StringIO)
def test_peking_duck(stdout): def test_peking_duck(stdout):
arguments = ['robotchef', 'Jacket Potato'] arguments = ["robotchef", "Jacket Potato"]
from robotchef_v2.main import main from robotchef_v2.main import main
with patch.object(sys, 'argv', arguments):
with patch.object(sys, "argv", arguments):
main() main()
eq_(stdout.getvalue(), 'I can bake Jacket Potato\n') eq_(stdout.getvalue(), "I can bake Jacket Potato\n")

View File

@ -4,9 +4,9 @@ organisation: "chfw"
author: "C.W." author: "C.W."
contact: "wangc_2011@hotmail.com" contact: "wangc_2011@hotmail.com"
company: "Onni Software Ltd." company: "Onni Software Ltd."
version: "0.0.4" version: "0.0.5"
current_version: "0.0.4" current_version: "0.0.5"
release: "0.0.4" release: "0.0.5"
copyright_year: 2017-2018 copyright_year: 2017-2018
license: New BSD license: New BSD
dependencies: [] dependencies: []

View File

@ -8,8 +8,8 @@
:license: New BSD License, see LICENSE for more details :license: New BSD License, see LICENSE for more details
""" """
import logging import logging
from lml._version import __version__ # flake8: noqa from lml._version import __version__ # noqa: F401
from lml._version import __author__ # flake8: noqa from lml._version import __author__ # noqa: F401
try: try:
from logging import NullHandler from logging import NullHandler

View File

@ -1,2 +1,2 @@
__version__ = "0.0.4" __version__ = "0.0.5"
__author__ = "C.W." __author__ = "C.W."

View File

@ -10,11 +10,11 @@
:license: New BSD License, see LICENSE for more details :license: New BSD License, see LICENSE for more details
""" """
import re import re
import pkgutil
import logging import logging
import pkgutil
from itertools import chain from itertools import chain
from lml.utils import do_import
from lml.utils import do_import
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -28,9 +28,7 @@
import logging import logging
from collections import defaultdict from collections import defaultdict
from lml.utils import do_import_class from lml.utils import json_dumps, do_import_class
from lml.utils import json_dumps
PLUG_IN_MANAGERS = {} PLUG_IN_MANAGERS = {}
CACHED_PLUGIN_INFO = defaultdict(list) CACHED_PLUGIN_INFO = defaultdict(list)

View File

@ -9,10 +9,10 @@
""" """
import sys import sys
import logging import logging
from json import dumps, JSONEncoder from json import JSONEncoder, dumps
PY2 = sys.version_info[0] == 2 PY2 = sys.version_info[0] == 2
PY36 = sys.version_info[0] == 3 and sys.version_info[1] >= 6
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -39,17 +39,26 @@ def json_dumps(keywords):
def do_import(plugin_module_name): def do_import(plugin_module_name):
"""dynamically import a module""" """dynamically import a module"""
try: if PY36:
plugin_module = __import__(plugin_module_name) try:
if "." in plugin_module_name: return _do_import(plugin_module_name)
modules = plugin_module_name.split(".") except (ImportError, ModuleNotFoundError): # noqa: F821
for module in modules[1:]: log.exception("failed to import %s", plugin_module_name)
plugin_module = getattr(plugin_module, module) else:
log.debug("found " + plugin_module_name) try:
return plugin_module return _do_import(plugin_module_name)
except ImportError: except ImportError:
log.exception("failed to import %s", plugin_module_name) log.exception("failed to import %s", plugin_module_name)
raise
def _do_import(plugin_module_name):
plugin_module = __import__(plugin_module_name)
if "." in plugin_module_name:
modules = plugin_module_name.split(".")
for module in modules[1:]:
plugin_module = getattr(plugin_module, module)
log.debug("found " + plugin_module_name)
return plugin_module
def do_import_class(plugin_class): def do_import_class(plugin_class):

View File

@ -11,17 +11,17 @@ PY26 = PY2 and sys.version_info[1] < 7
NAME = 'lml' NAME = 'lml'
AUTHOR = 'C.W.' AUTHOR = 'C.W.'
VERSION = '0.0.4' VERSION = '0.0.5'
EMAIL = 'wangc_2011@hotmail.com' EMAIL = 'wangc_2011@hotmail.com'
LICENSE = 'New BSD' LICENSE = 'New BSD'
DESCRIPTION = ( DESCRIPTION = (
'Load me later. A lazy plugin management system.' 'Load me later. A lazy plugin management system.'
) )
URL = 'https://github.com/chfw/lml' URL = 'https://github.com/chfw/lml'
DOWNLOAD_URL = '%s/archive/0.0.4.tar.gz' % URL DOWNLOAD_URL = '%s/archive/0.0.5.tar.gz' % URL
FILES = ['README.rst', 'CHANGELOG.rst'] FILES = ['README.rst', 'CHANGELOG.rst']
KEYWORDS = [ KEYWORDS = [
'python' 'python',
] ]
CLASSIFIERS = [ CLASSIFIERS = [
@ -46,8 +46,8 @@ EXTRAS_REQUIRE = {}
# You do not need to read beyond this line # You do not need to read beyond this line
PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format( PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format(
sys.executable) sys.executable)
GS_COMMAND = ('gs lml v0.0.4 ' + GS_COMMAND = ('gs lml v0.0.5 ' +
"Find 0.0.4 in changelog for more details") "Find 0.0.5 in changelog for more details")
NO_GS_MESSAGE = ('Automatic github release is disabled. ' + NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
'Please install gease to enable it.') 'Please install gease to enable it.')
UPLOAD_FAILED_MSG = ( UPLOAD_FAILED_MSG = (

View File

@ -1,2 +1,2 @@
pip freeze pip freeze
nosetests --with-cov --cover-package lml --cover-package tests --with-doctest --doctest-extension=.rst README.rst tests docs/source lml && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long nosetests --with-cov --cover-package lml --cover-package tests --with-doctest --doctest-extension=.rst README.rst tests docs/source lml && flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long

View File

@ -4,3 +4,5 @@ codecov
coverage coverage
flake8 flake8
six six
black;python_version>="3.6"
isort;python_version>="3.6"

View File

@ -1,5 +1,6 @@
from lml.plugin import PluginInfo
import json import json
from lml.plugin import PluginInfo
from nose.tools import eq_ from nose.tools import eq_

View File

@ -1,7 +1,11 @@
from mock import patch from mock import patch
from lml.plugin import PluginManager, PLUG_IN_MANAGERS from lml.plugin import (
from lml.plugin import PluginInfo, _show_me_your_name PLUG_IN_MANAGERS,
from lml.plugin import CACHED_PLUGIN_INFO CACHED_PLUGIN_INFO,
PluginInfo,
PluginManager,
_show_me_your_name,
)
from nose.tools import eq_, raises from nose.tools import eq_, raises

View File

@ -1,7 +1,7 @@
from mock import patch
from lml.utils import do_import, json_dumps
from lml.plugin import PluginManager from lml.plugin import PluginManager
from nose.tools import eq_, raises from nose.tools import eq_
from lml.utils import json_dumps
from lml.utils import do_import
def test_json_dumps(): def test_json_dumps():
@ -27,9 +27,10 @@ def test_do_import_2():
eq_(plugin, themodule) eq_(plugin, themodule)
@raises(ImportError) @patch("lml.utils.log.exception")
def test_do_import_error(): def test_do_import_error(mock_exception):
do_import("non.exist") do_import("non.exist")
mock_exception.assert_called_with("failed to import %s", "non.exist")
def test_do_import_cls(): def test_do_import_cls():