Utilities¶
Extract Links¶
- class markdown_checker.utils.extract_links.MarkdownLinks(urls, paths)¶
Bases:
objectDataclass to store markdown links
- Parameters:
urls (list[MarkdownURL])
paths (list[MarkdownPath])
- urls: list[MarkdownURL]¶
- paths: list[MarkdownPath]¶
- markdown_checker.utils.extract_links.get_links_from_md_file(file_path)¶
function to get an array of markdown urls, paths from a file flags markdown links captures the part inside () that comes right after []
- Args:
file_path (Path): The file path to check.
- Returns:
markdown_links (MarkdownLinks): Dataclass with urls and paths
- Parameters:
file_path (Path)
- Return type:
List Files¶
This module contains a function to get a list of file paths from a root directory and its subdirectories, filtered by file extension.
- markdown_checker.utils.list_files.get_files_paths_list(root_path, extensions=None)¶
Get a list of file paths from a root directory and its subdirectories, filtered by file extension.
- Args:
root_path (Path): The root directory to start the search. extensions (list[str]): A list of file extensions to filter the search.
- Returns:
A tuple containing a list of subdirectories and a list of file paths.
Spinner¶
- class markdown_checker.utils.spinner.Spinner(beep=False, disable=False, force=False, stream=sys.stdout)¶
Bases:
object- spinner_cycle = <itertools.cycle object>¶
- start()¶
- Return type:
None
- stop()¶
- Return type:
None
- init_spin()¶
- Return type:
None
- markdown_checker.utils.spinner.spinner(beep=False, disable=False, force=False, stream=sys.stdout)¶
This function creates a context manager that is used to display a spinner on stdout as long as the context has not exited.
The spinner is created only if stdout is not redirected, or if the spinner is forced using the
forceparameter.- Args:
- beep (bool):
Beep when spinner finishes.
- disable (bool):
Hide spinner.
- force (bool):
Force creation of spinner even when stdout is redirected.
Example¶
- with spinner():
do_something() do_something_else()