methods docs & import sorting

This commit is contained in:
ful1e5 2021-03-23 20:01:38 +05:30
parent b495940b97
commit bde717165b
4 changed files with 45 additions and 45 deletions

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from typing import Any, Dict, Tuple, TypeVar from pathlib import Path
from typing import Any, Dict, Tuple, TypeVar, Union
from clickgen.util import PNGProvider from clickgen.util import PNGProvider
@ -15,24 +16,20 @@ def to_tuple(x: X) -> Tuple[X, X]:
return (x, x) return (x, x)
def get_config(bitmaps_dir, **kwargs) -> Dict[str, Any]: def get_config(bitmaps_dir: Union[str, Path], **kwargs) -> Dict[str, Any]:
"""Return configuration of `Bibata` pointers. """Return configuration of `Bibata`.
``` :param bitmaps_dir: Path to .png file's directory.
Args: :type bitmaps_dir: Union[str, Path]
:bitmaps_dir: (str | Path) Path to .png file's directory. :param x_sizes: List of pixel-sizes for xcursors.
:type x_sizes: List[int]
:param win_canvas_size: Windows cursor's canvas pixel-size.
:type win_canvas_size: int
Keywords Args: :param win_size: Pixel-size for Windows cursor.
:type win_size: int
:x_sizes: (List[int]) List of pixel-sizes for xcursors.
:win_canvas_size: (int) Windows cursor's canvas pixel-size.
:win_size: (int) Pixel-size for Windows cursor.
```
Example: Example:

View file

@ -10,7 +10,6 @@ URL = "https://github.com/ful1e5/Bibata_Cursor"
# XCursor # XCursor
X_DELAY: int = 13 X_DELAY: int = 13
# Windows Cursor # Windows Cursor
WIN_DELAY = 1 WIN_DELAY = 1

View file

@ -4,13 +4,12 @@
from pathlib import Path from pathlib import Path
from typing import Any, Dict, NamedTuple from typing import Any, Dict, NamedTuple
from bbpkg.constants import AUTHOR, URL
from bbpkg.symlinks import add_missing_xcursor
from clickgen.builders import WindowsCursor, XCursor from clickgen.builders import WindowsCursor, XCursor
from clickgen.core import CursorAlias from clickgen.core import CursorAlias
from clickgen.packagers import WindowsPackager, XPackager from clickgen.packagers import WindowsPackager, XPackager
from bbpkg.constants import AUTHOR, URL
from bbpkg.symlinks import add_missing_xcursor
class Info(NamedTuple): class Info(NamedTuple):
name: str name: str
@ -20,14 +19,16 @@ class Info(NamedTuple):
def xbuild(config: Dict[str, Dict[str, Any]], x_out_dir: Path, info: Info) -> None: def xbuild(config: Dict[str, Dict[str, Any]], x_out_dir: Path, info: Info) -> None:
"""Build `Bibata` cursor theme for only `X11`(UNIX) platform. """Build `Bibata` cursor theme for only `X11`(UNIX) platform.
``` :param config: `Bibata` configuration.
:config: (Dict) `Bibata` configuration. :type config: Dict[str, Dict[str, Any]]
:x_out_dir: (Path) Path to the output directory, :param x_out_dir: Path to the output directory, \
Where the `X11` cursor theme package will generate. Where the `X11` cursor theme package will generate.\
It also creates a directory if not exists. It also creates a directory if not exists.
:info: (Dict) Content theme name & comment :type x_out_dir: Path
```
:param info: Content theme name & comment
:type info: Info
""" """
for _, item in config.items(): for _, item in config.items():
@ -48,14 +49,16 @@ def xbuild(config: Dict[str, Dict[str, Any]], x_out_dir: Path, info: Info) -> No
def wbuild(config: Dict[str, Dict[str, Any]], win_out_dir: Path, info: Info) -> None: def wbuild(config: Dict[str, Dict[str, Any]], win_out_dir: Path, info: Info) -> None:
"""Build `Bibata` cursor theme for only `Windows` platforms. """Build `Bibata` cursor theme for only `Windows` platforms.
``` :param config: `Bibata` configuration.
:config: (Dict) `Bibata` configuration. :type config: Dict[str, Dict[str, Any]]
:win_out_dir: (Path) Path to the output directory, :param win_out_dir: Path to the output directory,\
Where the `Windows` cursor theme package will generate. Where the `Windows` cursor theme package will \
It also creates a directory if not exists. generate. It also creates a directory if not exists.
:info: (Dict) Content theme name & comment :type win_out_dir: Path
```
:param info: Content theme name & comment
:type info: Dict
""" """
for _, item in config.items(): for _, item in config.items():
@ -88,18 +91,16 @@ def build(
) -> None: ) -> None:
"""Build `Bibata` cursor theme for `X11` & `Windows` platforms. """Build `Bibata` cursor theme for `X11` & `Windows` platforms.
``` :param config: `Bibata` configuration.
:config: (Dict) `Bibata` configuration. :type config: Dict[str, Dict[str, Any]]
:x_out_dir: (Path) Path to the output directory, :param win_out_dir: Path to the output directory,\
Where the `X11` cursor theme package will generate. Where the `Windows` cursor theme package will \
It also creates a directory if not exists. generate. It also creates a directory if not exists.
:type win_out_dir: Path
:win_out_dir: (Path) Path to the output directory, :param info: Content theme name & comment
Where the `Windows` cursor theme package will generate. :type info: Dict
It also creates a directory if not exists.
:info: (Dict) Content theme name & comment
```
""" """
def win_build(item: Dict[str, Any], alias: CursorAlias) -> None: def win_build(item: Dict[str, Any], alias: CursorAlias) -> None:

View file

@ -2,14 +2,17 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
from pathlib import Path
from typing import Union
from clickgen.util import chdir from clickgen.util import chdir
def add_missing_xcursor(directory) -> None: def add_missing_xcursor(directory: Union[str, Path]) -> None:
"""Add missing `XCursor` to the Unix cursor package. """Add missing `XCursor` to the Unix cursor package.
:directory: (Path|str) directory where XCursors are available. :param directory: directory where XCursors are available.
:type directory: Union[str, Path]
""" """
symlinks = [ symlinks = [