Code Documentation¶
Info
This documentation is automatically generated from the source code function description.
scripts.build
¶
This script is used to build the documentation.
Build multi-language documentation site.
Note
File : build.py Author : Baiqi.Lu ittuann@outlook.com License: MIT License.
Example
$ python ./scripts/build.py
build_docs()
¶
Build Multi-Language Documentation.
Source code in scripts/build.py
update_404page_title(file_path=cfg.SITE_PATH / '404.html')
¶
Update the title of the 404 page.
Source code in scripts/build.py
scripts.split
¶
Split Scripts.
This module provides functionalities to split a table based on the award filter column.
Note
File : split.py Author : Baiqi.Lu ittuann@outlook.com License: MIT License.
Example
$ python ./scripts/split.py
awardSort(awards)
¶
奖项排序.
根据指定的中文顺序对奖项进行排序。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
awards
|
Series
|
包含奖项名称的系列 |
required |
Returns:
Type | Description |
---|---|
Series
|
pd.Series: 排序后的系列 |
Source code in scripts/split.py
splitTable(filtration, outputDir, inputFile=cfg.TABLE_URL_PATH)
¶
根据给定的过滤列将主表拆分.
根据给定的过滤列将主表拆分为多个子表,并将子表保存在指定的输出目录中。 每个子表的名称为过滤列的值,例如,如果过滤列为"年份",则将生成多个子表,分别为"2022.csv"、"2021.csv"等。
Note
应首先运行 urlModification() 以获得修饰后的主表
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filtration
|
str
|
过滤的列名称 |
required |
outputDir
|
Path
|
输出目录路径 |
required |
inputFile
|
Path
|
输入的 CSV 文件路径。默认为将使用路径"./table-url.csv" |
TABLE_URL_PATH
|
Raises:
Type | Description |
---|---|
ValueError
|
如果输入的文件不存在,则抛出异常 |
ValueError
|
如果输出的目录不存在,则抛出异常 |
ValueError
|
如果指定的过滤列不是表的列,则抛出异常 |
Examples:
Source code in scripts/split.py
urlModification(inputFile=cfg.TABLE_PATH, outputFile=cfg.TABLE_URL_PATH)
¶
修饰主表的URL链接.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputFile
|
Path
|
输入的 CSV 文件路径。默认为将使用路径"./table.csv" |
TABLE_PATH
|
outputFile
|
Path
|
输出的 CSV 文件路径。默认为将使用路径"./table.csv" |
TABLE_URL_PATH
|
Raises:
Type | Description |
---|---|
ValueError
|
如果输入的文件不存在,则抛出异常 |
Examples:
Source code in scripts/split.py
tests.test_functions
¶
Code Coverage Test.
Note
File : test_functions.py Author : Baiqi.Lu ittuann@outlook.com License: MIT License.
test_awardSort()
¶
Test case for the awardSort function.
Source code in tests/test_functions.py
test_build_docs()
¶
Test case for the build_docs function.
Source code in tests/test_functions.py
test_config_initialization()
¶
Test case for the initialization of the Config class.
Source code in tests/test_functions.py
test_config_update_site_path()
¶
Test case for the update_site_path function.
Source code in tests/test_functions.py
test_splitTable_fail()
¶
Test case for the splitTable function with failure.
Source code in tests/test_functions.py
test_splitTable_success()
¶
Test case for the splitTable function with successful execution.
Source code in tests/test_functions.py
test_update_404page_title()
¶
Test case for the test_update_404page_title function. Need run build_docs() first.
Source code in tests/test_functions.py
test_update_404page_title_fail()
¶
Test case for the test_update_404page_title function with failure.
test_urlModification_fail()
¶
test_urlModification_success()
¶
Test case for the URLModification function with successful execution.