From 31518177b3bf0edfc719fecb1058385876703cf7 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sat, 1 Oct 2022 15:31:23 +0200 Subject: [PATCH] Formatting --- material/plugins/social/plugin.py | 10 ++++++---- material/plugins/tags/plugin.py | 4 ++-- src/plugins/social/plugin.py | 10 ++++++---- src/plugins/tags/plugin.py | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/material/plugins/social/plugin.py b/material/plugins/social/plugin.py index 290485663..4a7e34cac 100644 --- a/material/plugins/social/plugin.py +++ b/material/plugins/social/plugin.py @@ -20,6 +20,7 @@ import logging import os +import posixpath import re import requests import sys @@ -28,10 +29,9 @@ from collections import defaultdict from hashlib import md5 from io import BytesIO from mkdocs.commands.build import DuplicateFilter -from mkdocs.config.base import Config from mkdocs.config import config_options as opt +from mkdocs.config.base import Config from mkdocs.plugins import BasePlugin -import posixpath from shutil import copyfile from tempfile import TemporaryFile from zipfile import ZipFile @@ -47,7 +47,7 @@ except ImportError: # Class # ----------------------------------------------------------------------------- -# Configuration scheme +# Social plugin configuration scheme class SocialPluginConfig(Config): enabled = opt.Type(bool, default = True) cache_dir = opt.Type(str, default = ".cache/plugin/social") @@ -55,9 +55,11 @@ class SocialPluginConfig(Config): # Options for social cards cards = opt.Type(bool, default = True) cards_dir = opt.Type(str, default = "assets/images/social") - cards_color = opt.Type(dict, default = {}) + cards_color = opt.Type(dict, default = dict()) cards_font = opt.Optional(opt.Type(str)) +# ----------------------------------------------------------------------------- + # Social plugin class SocialPlugin(BasePlugin[SocialPluginConfig]): diff --git a/material/plugins/tags/plugin.py b/material/plugins/tags/plugin.py index 69f9e2514..af7c5d61d 100644 --- a/material/plugins/tags/plugin.py +++ b/material/plugins/tags/plugin.py @@ -34,10 +34,11 @@ from mkdocs.plugins import BasePlugin # Class # ----------------------------------------------------------------------------- -# Configuration scheme +# Tags plugin configuration scheme class TagsPluginConfig(Config): tags_file = opt.Optional(opt.Type(str)) +# ----------------------------------------------------------------------------- # Tags plugin class TagsPlugin(BasePlugin[TagsPluginConfig]): @@ -120,7 +121,6 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]): classes = " ".join(classes) content = [f"## {tag}", ""] for page in pages: - url = utils.get_relative_url( page.file.src_uri, self.tags_file.src_uri diff --git a/src/plugins/social/plugin.py b/src/plugins/social/plugin.py index 290485663..4a7e34cac 100644 --- a/src/plugins/social/plugin.py +++ b/src/plugins/social/plugin.py @@ -20,6 +20,7 @@ import logging import os +import posixpath import re import requests import sys @@ -28,10 +29,9 @@ from collections import defaultdict from hashlib import md5 from io import BytesIO from mkdocs.commands.build import DuplicateFilter -from mkdocs.config.base import Config from mkdocs.config import config_options as opt +from mkdocs.config.base import Config from mkdocs.plugins import BasePlugin -import posixpath from shutil import copyfile from tempfile import TemporaryFile from zipfile import ZipFile @@ -47,7 +47,7 @@ except ImportError: # Class # ----------------------------------------------------------------------------- -# Configuration scheme +# Social plugin configuration scheme class SocialPluginConfig(Config): enabled = opt.Type(bool, default = True) cache_dir = opt.Type(str, default = ".cache/plugin/social") @@ -55,9 +55,11 @@ class SocialPluginConfig(Config): # Options for social cards cards = opt.Type(bool, default = True) cards_dir = opt.Type(str, default = "assets/images/social") - cards_color = opt.Type(dict, default = {}) + cards_color = opt.Type(dict, default = dict()) cards_font = opt.Optional(opt.Type(str)) +# ----------------------------------------------------------------------------- + # Social plugin class SocialPlugin(BasePlugin[SocialPluginConfig]): diff --git a/src/plugins/tags/plugin.py b/src/plugins/tags/plugin.py index 69f9e2514..af7c5d61d 100644 --- a/src/plugins/tags/plugin.py +++ b/src/plugins/tags/plugin.py @@ -34,10 +34,11 @@ from mkdocs.plugins import BasePlugin # Class # ----------------------------------------------------------------------------- -# Configuration scheme +# Tags plugin configuration scheme class TagsPluginConfig(Config): tags_file = opt.Optional(opt.Type(str)) +# ----------------------------------------------------------------------------- # Tags plugin class TagsPlugin(BasePlugin[TagsPluginConfig]): @@ -120,7 +121,6 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]): classes = " ".join(classes) content = [f"## {tag}", ""] for page in pages: - url = utils.get_relative_url( page.file.src_uri, self.tags_file.src_uri