From 5c3092ac432ff4c6950bb8fccb11b2dd1b39b58d Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Tue, 22 May 2018 11:33:44 +0200 Subject: [PATCH] Create template subdir, move template there Could otherwise not get template.py out of installed code --- src/template.py | 100 ------------------------------------------------- templates/template.py | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 src/template.py create mode 100644 templates/template.py diff --git a/src/template.py b/src/template.py deleted file mode 100644 index 0e01357..0000000 --- a/src/template.py +++ /dev/null @@ -1,100 +0,0 @@ -# The software in this package is distributed under the GNU General -# Public License version 2 (with a special exception described below). -# -# A copy of GNU General Public License (GPL) is included in this distribution, -# in the file COPYING.GPL. -# -# As a special exception, if other files instantiate templates or use macros -# or inline functions from this file, or you compile this file and link it -# with other works to produce a work based on this file, this file -# does not by itself cause the resulting work to be covered -# by the GNU General Public License. -# -# However the source code for this file must still be made available -# in accordance with section (3) of the GNU General Public License. -# -# This exception does not invalidate any other reasons why a work based -# on this file might be covered by the GNU General Public License. - -""" -Module name: Summary of this module - -Some overview over important classes and functions and such should be specified -in this docstring, but please keep it brief! - - -.. seealso:: http://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html -.. todo:: Do not forget to correct the codeauthor and license text commented by - hashes above. -.. note:: You should note this -.. warning:: This is a warning - -.. codeauthor:: Intra2net -""" - -from __future__ import print_function - -THE_CONSTANT = None -""" some constant with docstring *AFTER* the constant. Use this format! """ - - -ANOTHER_CONSTANT = 1 #: short docstring in same line -- note the #: - -#: constant with docstring in line above it -- note the #: -THIRD_CONST = 3.333 - - -class TestClass: - """ - test class - - does nothing, really - """ - - def __init__(self, args): - """ constructor, gets its own paragraph in documentation - - :raises NotImplementedError: always - """ - raise NotImplementedError() - - def test_method(self, arg): - """ test method, does nothing - - for more doc string examples, see function :py:func:`send_message` - - :param arg: some argument - :return: Nothing - :raises NotImplementedError: always - """ - raise NotImplementedError() -# end: class TestClass - - -def send_message(sender, recipient, message_body, priority=1): - """ Send a message to a recipient - - Example for a docstring that uses lots of reST fields, taken from - http://sphinx-doc.org/domains.html - - Does not use :py:class:`TestClass` at all. Also has nothing to do with - the python module :py:mod:`logging.handlers` - - Note that it is completely irrelevant what :py:data:`THE_CONSTANT` or - :py:data:`ANOTHER_CONSTANT` or :py:data:`THIRD_CONSTANT` are set to. I just - wanted to insert a link to a constant somewhere and find out how to - document constants - - :param str sender: The person sending the message - :param str recipient: The recipient of the message - :param str message_body: The body of the message - :param priority: The priority of the message, can be a number 1-5 - :type priority: integer or None - :return: the message id - :rtype: int - :raises ValueError: if the message_body exceeds 160 characters - :raises TypeError: if the message_body is not a basestring - :raises NotImplementedError: always - """ - - raise NotImplementedError() diff --git a/templates/template.py b/templates/template.py new file mode 100644 index 0000000..0e01357 --- /dev/null +++ b/templates/template.py @@ -0,0 +1,100 @@ +# The software in this package is distributed under the GNU General +# Public License version 2 (with a special exception described below). +# +# A copy of GNU General Public License (GPL) is included in this distribution, +# in the file COPYING.GPL. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file +# does not by itself cause the resulting work to be covered +# by the GNU General Public License. +# +# However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based +# on this file might be covered by the GNU General Public License. + +""" +Module name: Summary of this module + +Some overview over important classes and functions and such should be specified +in this docstring, but please keep it brief! + + +.. seealso:: http://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html +.. todo:: Do not forget to correct the codeauthor and license text commented by + hashes above. +.. note:: You should note this +.. warning:: This is a warning + +.. codeauthor:: Intra2net +""" + +from __future__ import print_function + +THE_CONSTANT = None +""" some constant with docstring *AFTER* the constant. Use this format! """ + + +ANOTHER_CONSTANT = 1 #: short docstring in same line -- note the #: + +#: constant with docstring in line above it -- note the #: +THIRD_CONST = 3.333 + + +class TestClass: + """ + test class + + does nothing, really + """ + + def __init__(self, args): + """ constructor, gets its own paragraph in documentation + + :raises NotImplementedError: always + """ + raise NotImplementedError() + + def test_method(self, arg): + """ test method, does nothing + + for more doc string examples, see function :py:func:`send_message` + + :param arg: some argument + :return: Nothing + :raises NotImplementedError: always + """ + raise NotImplementedError() +# end: class TestClass + + +def send_message(sender, recipient, message_body, priority=1): + """ Send a message to a recipient + + Example for a docstring that uses lots of reST fields, taken from + http://sphinx-doc.org/domains.html + + Does not use :py:class:`TestClass` at all. Also has nothing to do with + the python module :py:mod:`logging.handlers` + + Note that it is completely irrelevant what :py:data:`THE_CONSTANT` or + :py:data:`ANOTHER_CONSTANT` or :py:data:`THIRD_CONSTANT` are set to. I just + wanted to insert a link to a constant somewhere and find out how to + document constants + + :param str sender: The person sending the message + :param str recipient: The recipient of the message + :param str message_body: The body of the message + :param priority: The priority of the message, can be a number 1-5 + :type priority: integer or None + :return: the message id + :rtype: int + :raises ValueError: if the message_body exceeds 160 characters + :raises TypeError: if the message_body is not a basestring + :raises NotImplementedError: always + """ + + raise NotImplementedError() -- 1.7.1