pydocmaker.util =============== .. py:module:: pydocmaker.util Attributes ---------- .. autoapisummary:: pydocmaker.util.colors_dc Classes ------- .. autoapisummary:: pydocmaker.util.bcolors pydocmaker.util._raise_missing Functions --------- .. autoapisummary:: pydocmaker.util.txtcolor pydocmaker.util.split_camel_case pydocmaker.util.flatten_list pydocmaker.util.generate_unique_id pydocmaker.util.get_page_title pydocmaker.util.path2attachment pydocmaker.util.upload_report_to_redmine pydocmaker.util.filename2identifier pydocmaker.util.bytes_path_exists pydocmaker.util.get_inp_context Module Contents --------------- .. py:class:: bcolors(*args, **kwds) Bases: :py:obj:`enum.Enum` Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: HEADER :value: '\x1b[95m' .. py:attribute:: OKBLUE :value: '\x1b[94m' .. py:attribute:: OKCYAN :value: '\x1b[96m' .. py:attribute:: OKGREEN :value: '\x1b[92m' .. py:attribute:: WARNING :value: '\x1b[93m' .. py:attribute:: FAIL :value: '\x1b[91m' .. py:attribute:: ENDC :value: '\x1b[0m' .. py:attribute:: BOLD :value: '\x1b[1m' .. py:attribute:: UNDERLINE :value: '\x1b[4m' .. py:data:: colors_dc .. py:function:: txtcolor(s: str, color: str) .. py:function:: split_camel_case(st: str) .. py:function:: flatten_list(lst) .. py:function:: generate_unique_id() .. py:function:: get_page_title(docname) .. py:function:: path2attachment(path, filename) .. py:function:: upload_report_to_redmine(doc, redmine, project_id, report_name=None, page_title=None, force_overwrite=False, verb=True) Uploads a report generated from a Doc object to a Redmine wiki page. :param doc: The Doc object containing the report data. :type doc: Doc :param redmine: A Redmine connection object. :type redmine: redminelib.Redmine :param project_id: The ID of the Redmine project where the report should be uploaded. :type project_id: str :param report_name: The name of the report. If not provided, the follwoing schema `%Y%m%d_%H%M_exported_report` will be used. :type report_name: str, optional :param page_title: The title of the Redmine wiki page. If not provided, it will be derived from the report name. :type page_title: str, optional :param force_overwrite: Whether to overwrite an existing page with the same title. Defaults to False. :type force_overwrite: bool, optional :param verb: Whether to print verbose output during upload. Defaults to True. :type verb: bool, optional :returns: The uploaded Redmine wiki page object. :rtype: redminelib.WikiPage :raises AssertionError: If any of the `doc`, `project_id` or `redmine` arguments is None or empty. .. py:function:: filename2identifier(filename) Converts a filename to a valid identifier by: 1. Stripping the file extension 2. Replacing any non-alphanumeric character with an underscore 3. Ensuring it doesn't start with a digit .. py:class:: _raise_missing(*args, **kwargs) .. py:method:: __getattr__(name) :classmethod: .. py:function:: bytes_path_exists(b: bytes, encoding: str = 'utf-8') -> bool Check if a bytes literal refers to an existing file/directory. .. py:function:: get_inp_context(default_name='main', context: dict = None, **kw)