File: doc.py

package info (click to toggle)
python-easydev 0.12.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 488 kB
  • sloc: python: 1,899; javascript: 49; makefile: 11
file content (44 lines) | stat: -rw-r--r-- 998 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- python -*-
# -*- coding: utf-8 -*-
#
#  This file is part of the easydev software
#
#  Copyright (c) 2011-2017
#
#  File author(s): Thomas Cokelaer <cokelaer@gmail.com>
#
#  Distributed under the GPLv3 License.
#  See accompanying file LICENSE.txt or copy at
#      http://www.gnu.org/licenses/gpl-3.0.html
#
#  Website: https://github.com/cokelaer/easydev
#  Documentation: http://easydev-python.readthedocs.io
#
##############################################################################
"""Module related to documentation


.. testsetup::

    from easydev.doc import *

"""
__all__ = ["underline"]


def underline(text, symbol="="):
    """Underlines a string with a specific character

    :param str text: the text to underline
    :param str symbol: the character to be used to underline the text
    :return: underlined text.

    .. doctest::

        >>> print(underline("test"))
        test
        ====

    """
    length = len(text)
    return text + "\n" + length * symbol