reST docstring, Typing & Linting fixes

This commit is contained in:
ful1e5 2021-03-31 16:57:35 +05:30
parent 6e0a8c5ae4
commit 38215c75c3
4 changed files with 90 additions and 70 deletions

View file

@ -4,13 +4,12 @@
from pathlib import Path
from typing import Any, Dict
from applbuild.constants import AUTHOR, COMMENT, THEME_NAME, URL
from applbuild.symlinks import add_missing_xcursor
from clickgen.builders import WindowsCursor, XCursor
from clickgen.core import CursorAlias
from clickgen.packagers import WindowsPackager, XPackager
from applbuild.constants import AUTHOR, COMMENT, THEME_NAME, URL
from applbuild.symlinks import add_missing_xcursor
def xbuild(
config: Dict[str, Dict[str, Any]],
@ -18,16 +17,20 @@ def xbuild(
) -> None:
"""Build `macOSBigSur` cursor theme for only `X11`(UNIX) platform.
:config: (Dict) `macOSBigSur` configuration.
:param config: `macOSBigSur` configuration.
:type config: Dict[str, Dict[str, Any]]
:x_out_dir: (Path) Path to the output directory, Where the `X11` cursor theme package will generate. It also creates a directory if not exists.
:param x_out_dir: Path to the output directory, \
Where the `X11` cursor theme package will\
generate. It also creates a directory if not exists.
:type x_out_dir: Path
"""
for _, item in config.items():
png = item.get("png")
hotspot = item.get("hotspot")
x_sizes = item.get("x_sizes")
delay = item.get("delay")
png = item["png"]
hotspot = item["hotspot"]
x_sizes = item["x_sizes"]
delay = item["delay"]
with CursorAlias.from_bitmap(png, hotspot) as alias:
x_cfg = alias.create(x_sizes, delay)
@ -41,26 +44,30 @@ def xbuild(
def wbuild(config: Dict[str, Dict[str, Any]], win_out_dir: Path) -> None:
"""Build `macOSBigSur` cursor theme for only `Windows` platforms.
:config: (Dict) `macOSBigSur` configuration.
:param config: `macOSBigSur` configuration.
:type config: Dict[str, Dict[str, Any]]
:win_out_dir: (Path) Path to the output directory, Where the `Windows` cursor theme package will generate. It also creates a directory if not exists.
:param win_out_dir: Path to the output directory, \
Where the `Windows` cursor theme package will\
generate. It also creates a directory if not exists.
:type win_out_dir: Path
"""
for _, item in config.items():
png = item.get("png")
hotspot = item.get("hotspot")
x_sizes = item.get("x_sizes")
delay = item.get("delay")
png = item["png"]
hotspot = item["hotspot"]
x_sizes = item["x_sizes"]
delay = item["delay"]
with CursorAlias.from_bitmap(png, hotspot) as alias:
alias.create(x_sizes, delay)
if item.get("win_key"):
position = item.get("position")
win_size = item.get("win_size")
win_key = item.get("win_key")
canvas_size = item.get("canvas_size")
win_delay = item.get("win_delay")
position = item["position"]
win_size = item["win_size"]
win_key = item["win_key"]
canvas_size = item["canvas_size"]
win_delay = item["win_delay"]
win_cfg = alias.reproduce(
win_size, canvas_size, position, delay=win_delay
@ -76,19 +83,26 @@ def build(
) -> None:
"""Build `macOSBigSur` cursor theme for `X11` & `Windows` platforms.
:config: (Dict) `macOSBigSur` configuration.
:param config: `macOSBigSur` configuration.
:type config: Dict[str, Dict[str, Any]]
:x_out_dir: (Path) Path to the output directory, Where the `X11` cursor theme package will generate. It also creates a directory if not exists.
:param x_out_dir: Path to the output directory, \
Where the `X11` cursor theme package will\
generate. It also creates a directory if not exists.
:type x_out_dir: Path
:win_out_dir: (Path) Path to the output directory, Where the `Windows` cursor theme package will generate. It also creates a directory if not exists.
:param win_out_dir: Path to the output directory, \
Where the `Windows` cursor theme package will\
generate. It also creates a directory if not exists.
:type win_out_dir: Path
"""
def win_build(item: Dict[str, Any], alias: CursorAlias) -> None:
position = item.get("position")
win_size = item.get("win_size")
win_key = item.get("win_key")
canvas_size = item.get("canvas_size")
win_delay = item.get("win_delay")
position = item["position"]
win_size = item["win_size"]
win_key = item["win_key"]
canvas_size = item["canvas_size"]
win_delay = item["win_delay"]
win_cfg = alias.reproduce(
win_size, canvas_size, position, delay=win_delay
@ -97,10 +111,10 @@ def build(
WindowsCursor.create(win_cfg, win_out_dir)
for _, item in config.items():
png = item.get("png")
hotspot = item.get("hotspot")
x_sizes = item.get("x_sizes")
delay = item.get("delay")
png = item["png"]
hotspot = item["hotspot"]
x_sizes = item["x_sizes"]
delay = item["delay"]
with CursorAlias.from_bitmap(png, hotspot) as alias:
x_cfg = alias.create(x_sizes, delay)