mirror of
https://github.com/rendercv/rendercv.git
synced 2026-02-07 03:51:26 -05:00
remove types from the docstrings
This commit is contained in:
@@ -36,7 +36,7 @@ def dictionary_to_yaml(dictionary: dict):
|
||||
"""Converts a dictionary to a YAML string.
|
||||
|
||||
Args:
|
||||
dictionary (dict): The dictionary to be converted to YAML.
|
||||
dictionary: The dictionary to be converted to YAML.
|
||||
Returns:
|
||||
str: The YAML string.
|
||||
"""
|
||||
|
||||
@@ -28,9 +28,9 @@ class LiveProgressReporter(rich.live.Live):
|
||||
reporting functionality.
|
||||
|
||||
Args:
|
||||
number_of_steps (int): The number of steps to be finished.
|
||||
end_message (str, optional): The message to be printed when the progress is
|
||||
finished. Defaults to "Your CV is rendered!".
|
||||
number_of_steps: The number of steps to be finished.
|
||||
end_message: The message to be printed when the progress is finished. Defaults
|
||||
to "Your CV is rendered!".
|
||||
"""
|
||||
|
||||
def __init__(self, number_of_steps: int, end_message: str = "Your CV is rendered!"):
|
||||
@@ -77,7 +77,7 @@ class LiveProgressReporter(rich.live.Live):
|
||||
"""Start a step and update the progress bars.
|
||||
|
||||
Args:
|
||||
step_name (str): The name of the step.
|
||||
step_name: The name of the step.
|
||||
"""
|
||||
self.current_step_name = step_name
|
||||
self.current_step_id = self.step_progress.add_task(
|
||||
@@ -161,7 +161,7 @@ def warning(text: str):
|
||||
"""Print a warning message to the terminal.
|
||||
|
||||
Args:
|
||||
text (str): The text of the warning message.
|
||||
text: The text of the warning message.
|
||||
"""
|
||||
print(f"[bold yellow]{text}")
|
||||
|
||||
@@ -172,8 +172,8 @@ def error(text: Optional[str] = None, exception: Optional[Exception] = None):
|
||||
given, then print an empty line and exit the program.
|
||||
|
||||
Args:
|
||||
text (str): The text of the error message.
|
||||
exception (Exception, optional): An exception object. Defaults to None.
|
||||
text: The text of the error message.
|
||||
exception: An exception object. Defaults to None.
|
||||
"""
|
||||
if exception is not None:
|
||||
exception_messages = [str(arg) for arg in exception.args]
|
||||
@@ -196,7 +196,7 @@ def information(text: str):
|
||||
"""Print an information message to the terminal.
|
||||
|
||||
Args:
|
||||
text (str): The text of the information message.
|
||||
text: The text of the information message.
|
||||
"""
|
||||
print(f"[green]{text}")
|
||||
|
||||
@@ -210,7 +210,7 @@ def print_validation_errors(exception: pydantic.ValidationError):
|
||||
in a nice table with [Rich](https://rich.readthedocs.io/en/latest/).
|
||||
|
||||
Args:
|
||||
exception (pydantic.ValidationError): The Pydantic validation error object.
|
||||
exception: The Pydantic validation error object.
|
||||
"""
|
||||
# This dictionary is used to convert the error messages that Pydantic returns to
|
||||
# more user-friendly messages.
|
||||
@@ -379,7 +379,7 @@ def handle_and_print_raised_exceptions(function: Callable) -> Callable:
|
||||
which means that the function `my_function` is modified by the `handle_exceptions`.
|
||||
|
||||
Args:
|
||||
function (Callable): The function to be wrapped.
|
||||
function: The function to be wrapped.
|
||||
|
||||
Returns:
|
||||
Callable: The wrapped function.
|
||||
|
||||
@@ -23,12 +23,11 @@ def set_or_update_a_value(
|
||||
be `cv.sections.education.3.institution` and the value can be "Bogazici University".
|
||||
|
||||
Args:
|
||||
dictionary (dict): The dictionary to set or update the value.
|
||||
key (str): The key to set or update the value.
|
||||
value (Any): The value to set or update.
|
||||
sub_dictionary (pydantic.BaseModel | dict | list, optional): The sub dictionary
|
||||
to set or update the value. This is used for recursive calls. Defaults to
|
||||
None.
|
||||
dictionary: The dictionary to set or update the value.
|
||||
key: The key to set or update the value.
|
||||
value: The value to set or update.
|
||||
sub_dictionary: The sub dictionary to set or update the value. This is used for
|
||||
recursive calls. Defaults to None.
|
||||
"""
|
||||
# Recursively call this function until the last key is reached:
|
||||
|
||||
@@ -82,8 +81,8 @@ def set_or_update_values(
|
||||
`set_or_update_a_value` function to set or update the values.
|
||||
|
||||
Args:
|
||||
dictionary (dict): The dictionary to set or update the values.
|
||||
key_and_values (dict[str, str]): The key and value pairs to set or update.
|
||||
dictionary: The dictionary to set or update the values.
|
||||
key_and_values: The key and value pairs to set or update.
|
||||
"""
|
||||
for key, value in key_and_values.items():
|
||||
dictionary = set_or_update_a_value(dictionary, key, value) # type: ignore
|
||||
@@ -96,8 +95,8 @@ def copy_files(paths: list[pathlib.Path] | pathlib.Path, new_path: pathlib.Path)
|
||||
path by adding a number to the end of the path.
|
||||
|
||||
Args:
|
||||
paths (list[pathlib.Path]): The paths of the files to be copied.
|
||||
new_path (pathlib.Path): The path to copy the files to.
|
||||
paths: The paths of the files to be copied.
|
||||
new_path: The path to copy the files to.
|
||||
"""
|
||||
if isinstance(paths, pathlib.Path):
|
||||
paths = [paths]
|
||||
@@ -158,7 +157,7 @@ def get_error_message_and_location_and_value_from_a_custom_error(
|
||||
return the three values.
|
||||
|
||||
Args:
|
||||
error_string (str): The error message.
|
||||
error_string: The error message.
|
||||
|
||||
Returns:
|
||||
tuple[Optional[str], Optional[str], Optional[str]]: The custom message,
|
||||
@@ -180,8 +179,8 @@ def copy_templates(
|
||||
"""Copy one of the folders found in `rendercv.templates` to `copy_to`.
|
||||
|
||||
Args:
|
||||
folder_name (str): The name of the folder to be copied.
|
||||
copy_to (pathlib.Path): The path to copy the folder to.
|
||||
folder_name: The name of the folder to be copied.
|
||||
copy_to: The path to copy the folder to.
|
||||
|
||||
Returns:
|
||||
Optional[pathlib.Path]: The path to the copied folder.
|
||||
@@ -213,7 +212,7 @@ def parse_render_command_override_arguments(
|
||||
pairs and return them as a dictionary.
|
||||
|
||||
Args:
|
||||
extra_arguments (typer.Context): The extra arguments context.
|
||||
extra_arguments: The extra arguments context.
|
||||
|
||||
Returns:
|
||||
dict["str", "str"]: The key and value pairs.
|
||||
@@ -273,8 +272,8 @@ def update_render_command_settings_of_the_input_file(
|
||||
(non-default) values of the `render` command's CLI arguments.
|
||||
|
||||
Args:
|
||||
input_file_as_a_dict (dict): The input file as a dictionary.
|
||||
render_command_cli_arguments (dict): The command line arguments of the `render`
|
||||
input_file_as_a_dict: The input file as a dictionary.
|
||||
render_command_cli_arguments: The command line arguments of the `render`
|
||||
command.
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -18,7 +18,7 @@ def dictionary_to_yaml(dictionary: dict) -> str:
|
||||
"""Converts a dictionary to a YAML string.
|
||||
|
||||
Args:
|
||||
dictionary (dict): The dictionary to be converted to YAML.
|
||||
dictionary: The dictionary to be converted to YAML.
|
||||
|
||||
Returns:
|
||||
str: The YAML string.
|
||||
@@ -40,7 +40,7 @@ def create_a_sample_data_model(
|
||||
"""Return a sample data model for new users to start with.
|
||||
|
||||
Args:
|
||||
name (str, optional): The name of the person. Defaults to "John Doe".
|
||||
name: The name of the person. Defaults to "John Doe".
|
||||
|
||||
Returns:
|
||||
RenderCVDataModel: A sample data model.
|
||||
@@ -76,10 +76,9 @@ def create_a_sample_yaml_input_file(
|
||||
is provided, then also save the contents to the file.
|
||||
|
||||
Args:
|
||||
input_file_path (pathlib.Path, optional): The path to save the input file.
|
||||
Defaults to None.
|
||||
name (str, optional): The name of the person. Defaults to "John Doe".
|
||||
theme (str, optional): The theme of the CV. Defaults to "classic".
|
||||
input_file_path: The path to save the input file. Defaults to None.
|
||||
name: The name of the person. Defaults to "John Doe".
|
||||
theme: The theme of the CV. Defaults to "classic".
|
||||
|
||||
Returns:
|
||||
str: The sample YAML input file as a string.
|
||||
@@ -184,7 +183,7 @@ def generate_json_schema_file(json_schema_path: pathlib.Path):
|
||||
"""Generate the JSON schema of RenderCV and save it to a file.
|
||||
|
||||
Args:
|
||||
json_schema_path (pathlib.Path): The path to save the JSON schema.
|
||||
json_schema_path: The path to save the JSON schema.
|
||||
"""
|
||||
schema = generate_json_schema()
|
||||
schema_json = json.dumps(schema, indent=2, ensure_ascii=False)
|
||||
|
||||
@@ -28,7 +28,7 @@ def format_phone_number(phone_number: str) -> str:
|
||||
```
|
||||
|
||||
Args:
|
||||
phone_number (str): The phone number to format.
|
||||
phone_number: The phone number to format.
|
||||
|
||||
Returns:
|
||||
str: The formatted phone number.
|
||||
@@ -57,9 +57,9 @@ def format_date(date: Date, date_style: Optional[str] = None) -> str:
|
||||
`#!python "May 2024"`
|
||||
|
||||
Args:
|
||||
date (Date): The date to format.
|
||||
date_style (Optional[str]): The style of the date string. If not provided, the
|
||||
default date style from the `locale_catalog` dictionary will be used.
|
||||
date: The date to format.
|
||||
date_style: The style of the date string. If not provided, the default date
|
||||
style from the `locale_catalog` dictionary will be used.
|
||||
|
||||
Returns:
|
||||
str: The formatted date.
|
||||
@@ -141,11 +141,10 @@ def compute_time_span_string(
|
||||
`#!python "4 months"`
|
||||
|
||||
Args:
|
||||
start_date (Optional[str]): A start date in YYYY-MM-DD, YYYY-MM, or YYYY format.
|
||||
end_date (Optional[str]): An end date in YYYY-MM-DD, YYYY-MM, or YYYY format or
|
||||
"present".
|
||||
date (Optional[str]): A date in YYYY-MM-DD, YYYY-MM, or YYYY format or a custom
|
||||
string. If provided, start_date and end_date will be ignored.
|
||||
start_date: A start date in YYYY-MM-DD, YYYY-MM, or YYYY format.
|
||||
end_date: An end date in YYYY-MM-DD, YYYY-MM, or YYYY format or "present".
|
||||
date: A date in YYYY-MM-DD, YYYY-MM, or YYYY format or a custom string. If
|
||||
provided, start_date and end_date will be ignored.
|
||||
|
||||
Returns:
|
||||
str: The computed time span string.
|
||||
@@ -230,14 +229,11 @@ def compute_date_string(
|
||||
```
|
||||
|
||||
Args:
|
||||
start_date (Optional[str]): A start date in YYYY-MM-DD, YYYY-MM, or YYYY
|
||||
format.
|
||||
end_date (Optional[str]): An end date in YYYY-MM-DD, YYYY-MM, or YYYY format
|
||||
or "present".
|
||||
date (Optional[str]): A date in YYYY-MM-DD, YYYY-MM, or YYYY format or
|
||||
a custom string. If provided, start_date and end_date will be ignored.
|
||||
show_only_years (bool): If True, only the years will be shown in the date
|
||||
string.
|
||||
start_date: A start date in YYYY-MM-DD, YYYY-MM, or YYYY format.
|
||||
end_date: An end date in YYYY-MM-DD, YYYY-MM, or YYYY format or "present".
|
||||
date: A date in YYYY-MM-DD, YYYY-MM, or YYYY format or a custom string. If
|
||||
provided, start_date and end_date will be ignored.
|
||||
show_only_years: If True, only the years will be shown in the date string.
|
||||
|
||||
Returns:
|
||||
str: The computed date string.
|
||||
@@ -306,7 +302,7 @@ def make_a_url_clean(url: str) -> str:
|
||||
`#!python "example.com"`
|
||||
|
||||
Args:
|
||||
url (str): The URL to make clean.
|
||||
url: The URL to make clean.
|
||||
|
||||
Returns:
|
||||
str: The clean URL.
|
||||
@@ -324,7 +320,7 @@ def get_date_object(date: str | int) -> Date:
|
||||
the data models.
|
||||
|
||||
Args:
|
||||
date (str | int): The date string to parse.
|
||||
date: The date string to parse.
|
||||
|
||||
Returns:
|
||||
Date: The parsed date.
|
||||
@@ -362,7 +358,7 @@ def dictionary_key_to_proper_section_title(key: str) -> str:
|
||||
`#!python "Section Title"`
|
||||
|
||||
Args:
|
||||
key (str): The key to convert to a proper section title.
|
||||
key: The key to convert to a proper section title.
|
||||
|
||||
Returns:
|
||||
str: The proper section title.
|
||||
|
||||
@@ -38,7 +38,7 @@ def validate_url(url: str) -> str:
|
||||
"""Validate a URL.
|
||||
|
||||
Args:
|
||||
url (str): The URL to validate.
|
||||
url: The URL to validate.
|
||||
|
||||
Returns:
|
||||
str: The validated URL.
|
||||
@@ -56,8 +56,8 @@ def create_a_section_validator(entry_type: Type) -> Type[SectionBase]:
|
||||
The section model is used to validate a section.
|
||||
|
||||
Args:
|
||||
entry_type (Type): The entry type to create the section model. It's not an
|
||||
instance of the entry type, but the entry type itself.
|
||||
entry_type: The entry type to create the section model. It's not an instance of
|
||||
the entry type, but the entry type itself.
|
||||
|
||||
Returns:
|
||||
Type[SectionBase]: The section validator (a Pydantic model).
|
||||
@@ -85,9 +85,9 @@ def get_characteristic_entry_attributes(
|
||||
"""Get the characteristic attributes of the entry types.
|
||||
|
||||
Args:
|
||||
entry_types (list[Type]): The entry types to get their characteristic
|
||||
attributes. These are not instances of the entry types, but the entry
|
||||
types themselves. `str` type should not be included in this list.
|
||||
entry_types: The entry types to get their characteristic attributes. These are
|
||||
not instances of the entry types, but the entry types themselves. `str` type
|
||||
should not be included in this list.
|
||||
|
||||
Returns:
|
||||
dict[Type, list[str]]: The characteristic attributes of the entry types.
|
||||
@@ -122,10 +122,10 @@ def get_entry_type_name_and_section_validator(
|
||||
type.
|
||||
|
||||
Args:
|
||||
entry (dict[str, str | list[str]] | str): The entry to determine its type.
|
||||
entry_types (list[Type]): The entry types to determine the entry type. These
|
||||
are not instances of the entry types, but the entry types themselves. `str`
|
||||
type should not be included in this list.
|
||||
entry: The entry to determine its type.
|
||||
entry_types: The entry types to determine the entry type. These are not
|
||||
instances of the entry types, but the entry types themselves. `str` type
|
||||
should not be included in this list.
|
||||
|
||||
Returns:
|
||||
tuple[str, Type[SectionBase]]: The entry type name and the section validator.
|
||||
@@ -176,10 +176,10 @@ def validate_a_section(
|
||||
list is validated with the section validator.
|
||||
|
||||
Args:
|
||||
sections_input (list[Any]): The sections input to validate.
|
||||
entry_types (list[Type]): The entry types to determine the entry type. These
|
||||
are not instances of the entry types, but the entry types themselves. `str`
|
||||
type should not be included in this list.
|
||||
sections_input: The sections input to validate.
|
||||
entry_types: The entry types to determine the entry type. These are not
|
||||
instances of the entry types, but the entry types themselves. `str` type
|
||||
should not be included in this list.
|
||||
|
||||
Returns:
|
||||
list[Any]: The validated sections input.
|
||||
@@ -239,7 +239,7 @@ def validate_a_social_network_username(username: str, network: str) -> str:
|
||||
"""Check if the `username` field in the `SocialNetwork` model is provided correctly.
|
||||
|
||||
Args:
|
||||
username (str): The username to validate.
|
||||
username: The username to validate.
|
||||
|
||||
Returns:
|
||||
str: The validated username.
|
||||
|
||||
@@ -35,12 +35,11 @@ def validate_design_options(
|
||||
theme data model, found in the `__init__.py` file of the custom theme folder.
|
||||
|
||||
Args:
|
||||
design (Any | RenderCVBuiltinDesign): The design options to validate.
|
||||
available_theme_options (dict[str, Type]): The available theme options. The keys
|
||||
are the theme names and the values are the corresponding data models.
|
||||
available_entry_type_names (list[str]): The available entry type names. These
|
||||
are used to validate if all the templates are provided in the custom theme
|
||||
folder.
|
||||
design: The design options to validate.
|
||||
available_theme_options: The available theme options. The keys are the theme
|
||||
names and the values are the corresponding data models.
|
||||
available_entry_type_names: The available entry type names. These are used to
|
||||
validate if all the templates are provided in the custom theme folder.
|
||||
|
||||
Returns:
|
||||
Any: The validated design as a Pydantic data model.
|
||||
|
||||
@@ -22,7 +22,7 @@ def validate_date_field(date: Optional[int | str]) -> Optional[int | str]:
|
||||
"""Check if the `date` field is provided correctly.
|
||||
|
||||
Args:
|
||||
date (Optional[int | str]): The date to validate.
|
||||
date: The date to validate.
|
||||
|
||||
Returns:
|
||||
Optional[int | str]: The validated date.
|
||||
@@ -57,7 +57,7 @@ def validate_start_and_end_date_fields(
|
||||
"""Check if the `start_date` and `end_date` fields are provided correctly.
|
||||
|
||||
Args:
|
||||
date (Optional[Literal["present"] | int | RenderCVDate]): The date to validate.
|
||||
date: The date to validate.
|
||||
|
||||
Returns:
|
||||
Optional[Literal["present"] | int | RenderCVDate]: The validated date.
|
||||
@@ -87,9 +87,9 @@ def validate_and_adjust_dates_for_an_entry(
|
||||
"""Check if the dates are provided correctly and make the necessary adjustments.
|
||||
|
||||
Args:
|
||||
start_date (StartDate): The start date of the event.
|
||||
end_date (EndDate): The end date of the event.
|
||||
date (ArbitraryDate): The date of the event.
|
||||
start_date: The start date of the event.
|
||||
end_date: The end date of the event.
|
||||
date: The date of the event.
|
||||
|
||||
Returns:
|
||||
EntryBase: The validated
|
||||
|
||||
@@ -16,8 +16,8 @@ def read_a_yaml_file(file_path_or_contents: pathlib.Path | str) -> dict:
|
||||
given as a path to the file or as the contents of the file as a string.
|
||||
|
||||
Args:
|
||||
file_path_or_contents (pathlib.Path | str): The path to the YAML file or the
|
||||
contents of the YAML file as a string.
|
||||
file_path_or_contents: The path to the YAML file or the contents of the YAML
|
||||
file as a string.
|
||||
|
||||
Returns:
|
||||
dict: The content of the YAML file as a dictionary.
|
||||
@@ -61,7 +61,7 @@ def validate_input_dictionary_and_return_the_data_model(
|
||||
which is a Pydantic data model of RenderCV's data format.
|
||||
|
||||
Args:
|
||||
input_dictionary (dict): The input dictionary.
|
||||
input_dictionary: The input dictionary.
|
||||
|
||||
Returns:
|
||||
RenderCVDataModel: The data model.
|
||||
@@ -80,8 +80,8 @@ def read_input_file(
|
||||
`RenderCVDataModel`, which is a Pydantic data model of RenderCV's data format.
|
||||
|
||||
Args:
|
||||
file_path_or_contents (str): The path to the input file or the contents of the
|
||||
input file as a string.
|
||||
file_path_or_contents: The path to the input file or the contents of the input
|
||||
file as a string.
|
||||
|
||||
Returns:
|
||||
RenderCVDataModel: The data model.
|
||||
|
||||
@@ -28,8 +28,8 @@ def copy_theme_files_to_output_directory(
|
||||
copied from the current working directory.
|
||||
|
||||
Args:
|
||||
theme_name (str): The name of the theme.
|
||||
output_directory_path (pathlib.Path): Path to the output directory.
|
||||
theme_name: The name of the theme.
|
||||
output_directory_path: Path to the output directory.
|
||||
"""
|
||||
if theme_name in data.available_themes:
|
||||
theme_directory_path = importlib.resources.files(
|
||||
@@ -75,8 +75,8 @@ def create_a_latex_file(
|
||||
directory.
|
||||
|
||||
Args:
|
||||
rendercv_data_model (dm.RenderCVDataModel): The data model.
|
||||
output_directory (pathlib.Path): Path to the output directory.
|
||||
rendercv_data_model: The data model.
|
||||
output_directory: Path to the output directory.
|
||||
|
||||
Returns:
|
||||
pathlib.Path: The path to the generated $\\LaTeX$ file.
|
||||
@@ -105,8 +105,8 @@ def create_a_markdown_file(
|
||||
directory.
|
||||
|
||||
Args:
|
||||
rendercv_data_model (dm.RenderCVDataModel): The data model.
|
||||
output_directory (pathlib.Path): Path to the output directory.
|
||||
rendercv_data_model: The data model.
|
||||
output_directory: Path to the output directory.
|
||||
|
||||
Returns:
|
||||
pathlib.Path: The path to the rendered Markdown file.
|
||||
@@ -135,8 +135,8 @@ def create_a_latex_file_and_copy_theme_files(
|
||||
copy the auxiliary theme files to the output directory.
|
||||
|
||||
Args:
|
||||
rendercv_data_model (dm.RenderCVDataModel): The data model.
|
||||
output_directory (pathlib.Path): Path to the output directory.
|
||||
rendercv_data_model: The data model.
|
||||
output_directory: Path to the output directory.
|
||||
|
||||
Returns:
|
||||
pathlib.Path: The path to the rendered $\\LaTeX$ file.
|
||||
@@ -154,7 +154,7 @@ def render_a_pdf_from_latex(
|
||||
"""Run TinyTeX with the given $\\LaTeX$ file to render the PDF.
|
||||
|
||||
Args:
|
||||
latex_file_path (str): The path to the $\\LaTeX$ file.
|
||||
latex_file_path: The path to the $\\LaTeX$ file.
|
||||
|
||||
Returns:
|
||||
pathlib.Path: The path to the rendered PDF file.
|
||||
@@ -283,7 +283,7 @@ def render_pngs_from_pdf(pdf_file_path: pathlib.Path) -> list[pathlib.Path]:
|
||||
"""Render a PNG file for each page of the given PDF file.
|
||||
|
||||
Args:
|
||||
pdf_file_path (pathlib.Path): The path to the PDF file.
|
||||
pdf_file_path: The path to the PDF file.
|
||||
|
||||
Returns:
|
||||
list[pathlib.Path]: The paths to the rendered PNG files.
|
||||
@@ -311,7 +311,7 @@ def render_an_html_from_markdown(markdown_file_path: pathlib.Path) -> pathlib.Pa
|
||||
directory. It uses `rendercv/themes/main.j2.html` as the Jinja2 template.
|
||||
|
||||
Args:
|
||||
markdown_file_path (pathlib.Path): The path to the Markdown file.
|
||||
markdown_file_path: The path to the Markdown file.
|
||||
|
||||
Returns:
|
||||
pathlib.Path: The path to the rendered HTML file.
|
||||
|
||||
@@ -8,7 +8,7 @@ import copy
|
||||
import pathlib
|
||||
import re
|
||||
from datetime import date as Date
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Optional, Literal
|
||||
|
||||
import jinja2
|
||||
|
||||
@@ -22,8 +22,8 @@ class TemplatedFile:
|
||||
templates.
|
||||
|
||||
Args:
|
||||
data_model (dm.RenderCVDataModel): The data model.
|
||||
environment (jinja2.Environment): The Jinja2 environment.
|
||||
data_model: The data model.
|
||||
environment: The Jinja2 environment.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -46,8 +46,8 @@ class TemplatedFile:
|
||||
"""Template one of the files in the `themes` directory.
|
||||
|
||||
Args:
|
||||
template_name (str): The name of the template file.
|
||||
entry (Optional[dm.Entry]): The title of the section.
|
||||
template_name: The name of the template file.
|
||||
entry: The title of the section.
|
||||
|
||||
Returns:
|
||||
str: The templated file.
|
||||
@@ -158,8 +158,8 @@ class LaTeXFile(TemplatedFile):
|
||||
"""Template one of the files in the `themes` directory.
|
||||
|
||||
Args:
|
||||
template_name (str): The name of the template file.
|
||||
entry (Optional[dm.Entry]): The data model of the entry.
|
||||
template_name: The name of the template file.
|
||||
entry: The data model of the entry.
|
||||
|
||||
Returns:
|
||||
str: The templated file.
|
||||
@@ -248,8 +248,8 @@ class MarkdownFile(TemplatedFile):
|
||||
"""Template one of the files in the `themes` directory.
|
||||
|
||||
Args:
|
||||
template_name (str): The name of the template file.
|
||||
entry (Optional[dm.Entry]): The data model of the entry.
|
||||
template_name: The name of the template file.
|
||||
entry: The data model of the entry.
|
||||
|
||||
Returns:
|
||||
str: The templated file.
|
||||
@@ -287,8 +287,7 @@ def revert_nested_latex_style_commands(latex_string: str) -> str:
|
||||
unitalicize a bold or italicized text.
|
||||
|
||||
Args:
|
||||
latex_string (str): The string to revert the nested $\\LaTeX$ style
|
||||
commands.
|
||||
latex_string: The string to revert the nested $\\LaTeX$ style commands.
|
||||
|
||||
Returns:
|
||||
str: The string with the reverted nested $\\LaTeX$ style commands.
|
||||
@@ -331,9 +330,9 @@ def escape_latex_characters(latex_string: str, strict: bool = True) -> str:
|
||||
`#!python "This is a \\# string."`
|
||||
|
||||
Args:
|
||||
latex_string (str): The string to escape.
|
||||
strict (bool): Whether to escape all the special $\\LaTeX$ characters or not. If
|
||||
you want to allow math input, set it to False.
|
||||
latex_string: The string to escape.
|
||||
strict: Whether to escape all the special $\\LaTeX$ characters or not. If you
|
||||
want to allow math input, set it to False.
|
||||
|
||||
Returns:
|
||||
str: The escaped string.
|
||||
@@ -407,7 +406,7 @@ def markdown_to_latex(markdown_string: str) -> str:
|
||||
`#!python "This is a \\textbf{bold} text with a \\href{https://google.com}{\\textit{link}}."`
|
||||
|
||||
Args:
|
||||
markdown_string (str): The Markdown string to convert.
|
||||
markdown_string: The Markdown string to convert.
|
||||
|
||||
Returns:
|
||||
str: The $\\LaTeX$ string.
|
||||
@@ -466,7 +465,7 @@ def transform_markdown_sections_to_latex_sections(
|
||||
characters.
|
||||
|
||||
Args:
|
||||
sections (Optional[dict[str, dm.SectionInput]]): Sections with Markdown strings.
|
||||
sections: Sections with Markdown strings.
|
||||
|
||||
Returns:
|
||||
Optional[dict[str, dm.SectionInput]]: Sections with $\\LaTeX$ strings.
|
||||
@@ -511,8 +510,8 @@ def replace_placeholders_with_actual_values(
|
||||
This function can be used as a Jinja2 filter in templates.
|
||||
|
||||
Args:
|
||||
text (str): The text with placeholders.
|
||||
placeholders (dict[str, str]): The placeholders and their values.
|
||||
text: The text with placeholders.
|
||||
placeholders: The placeholders and their values.
|
||||
|
||||
Returns:
|
||||
str: The string with actual values.
|
||||
@@ -524,7 +523,9 @@ def replace_placeholders_with_actual_values(
|
||||
|
||||
|
||||
def make_matched_part_something(
|
||||
value: str, something: str, match_str: Optional[str] = None
|
||||
value: str,
|
||||
something: Literal["textbf", "underline", "textit", "mbox"],
|
||||
match_str: Optional[str] = None,
|
||||
) -> str:
|
||||
"""Make the matched parts of the string something. If the match_str is None, the
|
||||
whole string will be made something.
|
||||
@@ -534,9 +535,9 @@ def make_matched_part_something(
|
||||
`make_matched_part_underlined`, `make_matched_part_italic`, or
|
||||
`make_matched_part_non_line_breakable instead.
|
||||
Args:
|
||||
value (str): The string to make something.
|
||||
something (str): The $\\LaTeX$ command to use.
|
||||
match_str (str): The string to match.
|
||||
value: The string to make something.
|
||||
something: The $\\LaTeX$ command to use.
|
||||
match_str: The string to match.
|
||||
|
||||
Returns:
|
||||
str: The string with the matched part something.
|
||||
@@ -567,8 +568,8 @@ def make_matched_part_bold(value: str, match_str: Optional[str] = None) -> str:
|
||||
`#!python "\\textbf{Hello} World!"`
|
||||
|
||||
Args:
|
||||
value (str): The string to make bold.
|
||||
match_str (str): The string to match.
|
||||
value: The string to make bold.
|
||||
match_str: The string to match.
|
||||
|
||||
Returns:
|
||||
str: The string with the matched part bold.
|
||||
@@ -592,8 +593,8 @@ def make_matched_part_underlined(value: str, match_str: Optional[str] = None) ->
|
||||
`#!python "\\underline{Hello} World!"`
|
||||
|
||||
Args:
|
||||
value (str): The string to make underlined.
|
||||
match_str (str): The string to match.
|
||||
value: The string to make underlined.
|
||||
match_str: The string to match.
|
||||
|
||||
Returns:
|
||||
str: The string with the matched part underlined.
|
||||
@@ -617,8 +618,8 @@ def make_matched_part_italic(value: str, match_str: Optional[str] = None) -> str
|
||||
`#!python "\\textit{Hello} World!"`
|
||||
|
||||
Args:
|
||||
value (str): The string to make italic.
|
||||
match_str (str): The string to match.
|
||||
value: The string to make italic.
|
||||
match_str: The string to match.
|
||||
|
||||
Returns:
|
||||
str: The string with the matched part italic.
|
||||
@@ -644,8 +645,8 @@ def make_matched_part_non_line_breakable(
|
||||
`#!python "\\mbox{Hello} World!"`
|
||||
|
||||
Args:
|
||||
value (str): The string to disable line breaks.
|
||||
match_str (str): The string to match.
|
||||
value: The string to disable line breaks.
|
||||
match_str: The string to match.
|
||||
|
||||
Returns:
|
||||
str: The string with the matched part non line breakable.
|
||||
@@ -668,7 +669,7 @@ def abbreviate_name(name: Optional[str]) -> str:
|
||||
`#!python "J. Doe"`
|
||||
|
||||
Args:
|
||||
name (str): The name to abbreviate.
|
||||
name: The name to abbreviate.
|
||||
|
||||
Returns:
|
||||
str: The abbreviated name.
|
||||
@@ -705,8 +706,8 @@ def divide_length_by(length: str, divider: float) -> str:
|
||||
`#!python "5.2cm"`
|
||||
|
||||
Args:
|
||||
length (str): The length to divide.
|
||||
divider (float): The number to divide the length by.
|
||||
length: The length to divide.
|
||||
divider: The number to divide the length by.
|
||||
|
||||
Returns:
|
||||
str: The divided length.
|
||||
@@ -746,9 +747,9 @@ def get_an_item_with_a_specific_attribute_value(
|
||||
This function can be used as a Jinja2 filter in templates.
|
||||
|
||||
Args:
|
||||
items (list[Any]): The list of items.
|
||||
attribute (str): The attribute to check.
|
||||
value (Any): The value of the attribute.
|
||||
items: The list of items.
|
||||
attribute: The attribute to check.
|
||||
value: The value of the attribute.
|
||||
|
||||
Returns:
|
||||
Any: The item with the specific attribute value.
|
||||
|
||||
@@ -157,7 +157,7 @@ def return_a_value_for_a_field_type(
|
||||
`#!python "Boğaziçi University"`
|
||||
|
||||
Args:
|
||||
field_type (typing.Any): _description_
|
||||
field_type: _description_
|
||||
|
||||
Returns:
|
||||
str: _description_
|
||||
@@ -245,7 +245,7 @@ def create_combinations_of_a_model(
|
||||
possible combinations of them.
|
||||
|
||||
Args:
|
||||
model (Type[data.Entry]): The data model class to create combinations of.
|
||||
model: The data model class to create combinations of.
|
||||
|
||||
Returns:
|
||||
list[data.Entry]: All possible instances of the model.
|
||||
@@ -356,8 +356,8 @@ def are_these_two_directories_the_same(
|
||||
"""Check if two directories are the same.
|
||||
|
||||
Args:
|
||||
directory1 (pathlib.Path): The first directory to compare.
|
||||
directory2 (pathlib.Path): The second directory to compare.
|
||||
directory1: The first directory to compare.
|
||||
directory2: The second directory to compare.
|
||||
|
||||
Raises:
|
||||
AssertionError: If the two directories are not the same.
|
||||
@@ -382,8 +382,8 @@ def are_these_two_files_the_same(file1: pathlib.Path, file2: pathlib.Path) -> bo
|
||||
"""Check if two files are the same.
|
||||
|
||||
Args:
|
||||
file1 (pathlib.Path): The first file to compare.
|
||||
file2 (pathlib.Path): The second file to compare.
|
||||
file1: The first file to compare.
|
||||
file2: The second file to compare.
|
||||
|
||||
Raises:
|
||||
AssertionError: If the two files are not the same.
|
||||
|
||||
Reference in New Issue
Block a user