add more docstring examples, restructure files

This commit is contained in:
Jannik Beyerstedt 2020-04-30 16:07:45 +02:00
parent 4a1c0adff2
commit 2afa3e36c2
9 changed files with 145 additions and 17 deletions

24
cpp/template-file.cpp Normal file
View file

@ -0,0 +1,24 @@
/**
* @file template-file.h
* @brief File containing example of doxygen usage for quick reference.
*
* Here typically goes a more extensive explanation of what the header defines.
*
* @author Name <email@example.com>
* @copyright (c) Company Name/ Author, YEAR
* @copyright Licensed under the Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>
* @copyright Licensed under the GNU GPLv3 License <http://www.gnu.org/licenses/gpl-3.0.txt>
*/
// include system headers here
// then include more specific library headers
// include local headers last
/**
* The implementation specific explanation might also be added to the source file.
*/
int add(int a, int b) {
return a + b;
}

43
cpp/template-file.h Normal file
View file

@ -0,0 +1,43 @@
/**
* @file template-file.h
* @brief File containing example of doxygen usage for quick reference.
*
* Here typically goes a more extensive explanation of what the header defines.
*
* @author Name <email@example.com>
* @copyright (c) Company Name/ Author, YEAR
* @copyright Licensed under the Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>
* @copyright Licensed under the GNU GPLv3 License <http://www.gnu.org/licenses/gpl-3.0.txt>
*/
#ifndef _TEMPLATE_FILE_H
#define _TEMPLATE_FILE_H
// include system headers here
// then include more specific library headers
// include local headers last
/**
* @brief Use brief, otherwise the index won't have a brief explanation.
*
* Detailed explanation.
*/
typedef enum BoxEnum_enum {
BOXENUM_FIRST, /**< Some documentation for first. */
BOXENUM_SECOND, /**< Some documentation for second. */
BOXENUM_ETC /**< Etc. */
} BoxEnum;
/**
* @brief This method adds two integers.
*
* Detailed explanation.
* @param a First integer to add.
* @param b Second integer to add.
* @return The sum of both parameters.
*/
int add(int a, int b);
#endif /* _TEMPLATE_FILE_H */

View file

@ -1,10 +0,0 @@
/*
* $name library
* $description
* for $description
*
* copyright: Jannik Beyerstedt <code@jannikbeyerstedt.de>
* license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
*/
// TODO: better license text!!!

View file

@ -13,10 +13,3 @@
* HELPERS * HELPERS
*/ */
/* CSS HERE */ /* CSS HERE */
/*
* KIRBYTAGS
*/
/* CSS HERE */

View file

30
python/template-main.py Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env python3
"""
Project - Application Title
TODO: Add a short explanation of the application here.
"""
import argparse
import logging
if __name__ == "__main__":
log_format = '%(asctime)s %(levelname)s:%(name)s: %(message)s'
log_datefmt = '%Y-%m-%dT%H:%M:%S%z'
logging.basicConfig(format=log_format, datefmt=log_datefmt, level=logging.INFO)
logger = logging.getLogger()
parser = argparse.ArgumentParser(description='TODO Program Title')
parser.add_argument('-n', '--dryrun', action='store_true',
help='do not connect to the FMU')
parser.add_argument("-v", "--verbosity", action="count",
help="increase output and logging verbosity")
args = parser.parse_args()
if args.verbosity == 2:
logger.setLevel(logging.DEBUG)
elif args.verbosity == 1:
logger.setLevel(logging.INFO)
else:
logger.setLevel(logging.WARNING)

48
python/template-module.py Normal file
View file

@ -0,0 +1,48 @@
"""
TODO This is just an example of a module docstring. Explain what this module
does at this place.
"""
import logging
LOGGER = logging.getLogger(__name__)
class MyClass:
"""
Put a short explanation of this class here.
Attributes:
public_param: Some publicly accessible parameter
"""
_private_param: str
public_param: int
def __init__(self, param1):
"""
The constructor for MyClass.
Parameters:
param1: Description of param1
"""
_private_param = param1
def my_function(param1: int) -> int:
"""
Summary line.
Extended description of function.
Parameters:
param1: Description of param1
Returns:
Description of return value
"""
return param1 * 5
if __name__ == "__main__":
LOGGER.error("do not run this on it's own")