py2403homework.utils#
提供了一些有用的类型,用于生成作业文档源文件。
This module provides some useful types to generate source files of homework documentation.
Classes
|
普通事件类型,也是所有 event type 的基类。 |
可生成文档类型的抽象基类。 |
|
|
|
|
|
|
可生成文档类型的一个简单实现。 |
|
- class py2403homework.utils.Generatable[源代码]#
基类:
object可生成文档类型的抽象基类。
Abstract base class of doc-generatable types.
- class py2403homework.utils.Simple(title: str, content: str | None = None)[源代码]#
基类:
Generatable可生成文档类型的一个简单实现。
A simple implementation of a doc-generatable type.
- 参数:
title -- 章节标题,不能超过一行 section title within a line
content -- 标题后的正文 the body after
title
- title#
由
title参数设置set by argument
title
- content#
由
content参数设置set by argument
content
- dumps() str[源代码]#
生成文档。
Generate the documentation.
先调用
generate_title()生成标题部分,与后面的content以\n\n相隔,即一个空行。Call
generate_title()first to generate the title part, followed by\n\n(A blank line), thencontent.
- class py2403homework.utils.Event(description: str | None = None, name: str | None = None, date: date | str | None = None, content: str | None = None)[源代码]#
基类:
Simple普通事件类型,也是所有 event type 的基类。
General event type, also the base class of all event types.
- 参数:
description -- 对于事件的描述,若不为空,则标题后会加上 `` --- {description}``
name -- 事件名称,默认使用
DEFAULT_NAMEdate -- 事件日期,若为空则调用
time.strftime();若为字符串则直接使用,为datetime.date类型时用'{date.year:0>4}/{date.month:0>2}/{date.day:0>2}'的格式转换,并放在标题的开头
- class py2403homework.utils.Homework(date: date | str | None = None, date_limit: str | None = None, description: str | None = None, content: str | None = None, content_fmt: str | None = None)[源代码]#
基类:
Event- DEFAULT_NAME: str = '作业'#
默认事件类型名称,作为
name参数的默认值使用default event format name, used as the default value of argument
name
- dumps()[源代码]#
生成文档。
Generate the documentation.
先调用
generate_title()生成标题部分,与后面的content以\n\n相隔,即一个空行。Call
generate_title()first to generate the title part, followed by\n\n(A blank line), thencontent.