55# ##################################
66
77# standard library
8- import logging
98from collections .abc import Iterable
109from datetime import date , datetime
1110from functools import lru_cache
@@ -76,16 +75,21 @@ def __init__(
7675 mkdocs_command_is_on_serve : bool = False ,
7776 path : str = "." ,
7877 use_git : bool = True ,
79- ):
78+ ) -> None :
8079 """Class hosting the plugin logic.
8180
8281 Args:
83- path (str, optional): path to the git repository to use. Defaults to ".".
84- use_git (bool, optional): flag to use git under the hood or not. Defaults to True.
82+ cache_dir: _description_. Defaults to DEFAULT_CACHE_FOLDER.
8583 integration_material_blog (bool, optional): option to enable
86- integration with Blog plugin from Material theme. Defaults to True.
84+ integration with Blog plugin from Material theme. \
85+ Defaults to None.
8786 integration_material_social_cards (bool, optional): option to enable
88- integration with Social Cards plugin from Material theme. Defaults to True.
87+ integration with Social Cards plugin from Material theme. \
88+ Defaults to None.
89+ mkdocs_command_is_on_serve: _description_. Defaults to False.
90+ path (str, optional): path to the git repository to use. Defaults to ".".
91+ use_git (bool, optional): flag to use git under the hood or not. \
92+ Defaults to True.
8993 """
9094 self .mkdocs_command_is_on_serve = mkdocs_command_is_on_serve
9195 if self .mkdocs_command_is_on_serve :
@@ -294,20 +298,20 @@ def get_file_dates(
294298 format = "%at" ,
295299 )
296300 except GitCommandError as err :
297- logging . warning (
301+ logger . info (
298302 f"Unable to read git logs of '{ in_page .file .abs_src_path } '. "
299303 "Is git log readable? Falling back to build date. "
300304 "To disable this warning, set 'use_git: false' in plugin options. "
301305 f"Trace: { err } "
302306 )
303307 except GitCommandNotFound as err :
304- logging . error (
308+ logger . warning (
305309 "Unable to perform command 'git log'. Is git installed? "
306310 "Falling back to build date. "
307311 "To disable this warning, set 'use_git: false' in plugin options. "
308312 f"Trace: { err } "
309313 )
310- self .git_is_valid = 0
314+ self .git_is_valid = False
311315 # convert timestamps into datetimes
312316 if isinstance (dt_created , (str , float , int )) and dt_created :
313317 dt_created = set_datetime_zoneinfo (
@@ -374,7 +378,7 @@ def get_authors_from_meta(self, in_page: Page) -> Optional[tuple[str]]:
374378 elif isinstance (in_page .meta .get ("author" ), (list , tuple )):
375379 return tuple (in_page .meta .get ("author" ))
376380 else :
377- logging .warning (
381+ logger .warning (
378382 "Type of author value in page.meta "
379383 f"({ in_page .file .abs_src_path } ) is not valid. "
380384 "It should be str, list or tuple, "
@@ -396,7 +400,7 @@ def get_authors_from_meta(self, in_page: Page) -> Optional[tuple[str]]:
396400 else :
397401 return tuple (in_page .meta .get ("authors" ))
398402 else :
399- logging .warning (
403+ logger .warning (
400404 "Type of authors value in page.meta (%s) is not valid. "
401405 "It should be str, list or tuple, not: %s."
402406 % in_page .file .abs_src_path ,
@@ -754,8 +758,8 @@ def get_site_url(mkdocs_config: MkDocsConfig) -> Optional[str]:
754758 Returns:
755759 str | None: site url
756760 """
757- # this method exists because the following line returns an empty string instead of \
758- # None (because the key always exists)
761+ # this method exists because the following line returns an empty string instead
762+ # of None (because the key always exists)
759763 defined_site_url = mkdocs_config .site_url
760764
761765 # cases
0 commit comments