drawlib 0.1.32__tar.gz → 0.1.33.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of drawlib might be problematic. Click here for more details.

Files changed (64) hide show
  1. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/PKG-INFO +1 -1
  2. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/__init__.py +1 -1
  3. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/__main__.py +0 -1
  4. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/apis.py +1 -1
  5. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/__init__.py +1 -0
  6. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/apis.py +42 -68
  7. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/command.py +16 -28
  8. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/colors.py +1 -3
  9. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/dimage.py +17 -39
  10. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/fonts.py +7 -14
  11. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/model.py +126 -135
  12. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/theme.py +62 -120
  13. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/theme_officials.py +71 -42
  14. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/theme_style_caches.py +13 -309
  15. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/util.py +33 -47
  16. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/base.py +60 -60
  17. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/canvas.py +16 -26
  18. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/image.py +16 -18
  19. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/line.py +17 -28
  20. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/original_arrow.py +7 -11
  21. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/original_polygon.py +10 -18
  22. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/patches.py +4 -17
  23. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/text.py +7 -11
  24. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/download.py +5 -3
  25. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/dutil/dutil_canvas.py +4 -5
  26. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/dutil/dutil_color.py +2 -3
  27. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/dutil/dutil_script.py +5 -1
  28. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/dutil/settings.py +18 -19
  29. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/icons/phosphor.py +9 -1543
  30. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/icons/util.py +5 -5
  31. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/logging.py +1 -0
  32. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/smartarts/bubblespeech.py +7 -7
  33. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/smartarts/dsart.py +1 -1
  34. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/smartarts/sourcecode.py +22 -22
  35. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/util.py +30 -34
  36. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/args.py +11 -20
  37. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/color.py +1 -3
  38. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/coordinate.py +9 -15
  39. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/icon.py +0 -1
  40. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/image.py +2 -1
  41. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/line.py +0 -3
  42. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/shape.py +1 -4
  43. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/smartarts.py +0 -1
  44. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/style.py +2 -8
  45. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/text.py +2 -1
  46. drawlib-0.1.33.dev1/pyproject.toml +46 -0
  47. drawlib-0.1.32/drawlib/.pylintrc +0 -2
  48. drawlib-0.1.32/pyproject.toml +0 -35
  49. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/LICENSE.txt +0 -0
  50. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/README.md +0 -0
  51. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/assets/__init__.py +0 -0
  52. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/assets/v0_1/__init__.py +0 -0
  53. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/assets/v0_1/fonticons/__init__.py +0 -0
  54. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/assets/v0_1/fonts/__init__.py +0 -0
  55. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/__main__.py +0 -0
  56. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/__init__.py +0 -0
  57. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/__init__.py +0 -0
  58. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core/model_system_default.py +0 -0
  59. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/core_canvas/__init__.py +0 -0
  60. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/dutil/__init__.py +0 -0
  61. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/icons/__init__.py +0 -0
  62. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/smartarts/__init__.py +0 -0
  63. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/__init__.py +0 -0
  64. {drawlib-0.1.32 → drawlib-0.1.33.dev1}/drawlib/v0_1/private/validators/types.py +6 -6
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: drawlib
3
- Version: 0.1.32
3
+ Version: 0.1.33.dev1
4
4
  Summary: Python drawing library. Illustration as Code.
5
5
  Home-page: https://www.drawlib.com
6
6
  Author: Yuichi Ito
@@ -12,7 +12,7 @@
12
12
  from typing import Final
13
13
 
14
14
  # please update here when you release new version
15
- VERSION = "0.1.32"
15
+ VERSION = "0.1.33.dev1"
16
16
 
17
17
  # might not be changed
18
18
  LIB_NAME: Final[str] = "drawlib"
@@ -14,7 +14,6 @@ from drawlib.v0_1.private.command import call
14
14
 
15
15
  def main() -> None:
16
16
  """Call latest drawlib command"""
17
-
18
17
  call()
19
18
 
20
19
 
@@ -7,7 +7,7 @@
7
7
  # express or implied, including but not limited to the warranties of
8
8
  # merchantability, fitness for a particular purpose and noninfringement.
9
9
 
10
- # pylint: disable=unused-wildcard-import, wildcard-import
10
+ # ruff: noqa: F403
11
11
 
12
12
  """Latest API module."""
13
13
 
@@ -10,6 +10,7 @@
10
10
  """Root package of API v0.1"""
11
11
 
12
12
  from typing import Final
13
+
13
14
  import drawlib
14
15
 
15
16
  # this API package is latest now. So, API version is same to software's one.
@@ -9,38 +9,26 @@
9
9
 
10
10
  """API v0.1 module."""
11
11
 
12
- # pylint: disable=unused-import
13
-
14
- #############
15
- ### Class ###
16
- #############
12
+ # ruff: noqa: F401
17
13
 
18
14
  from drawlib.v0_1.private.core.colors import (
19
15
  Colors,
20
16
  Colors140,
17
+ ColorsBase,
21
18
  ColorsThemeDefault,
22
19
  ColorsThemeEssentials,
23
20
  ColorsThemeMonochrome,
24
- # ColorsThemeFlatUI,
25
- ColorsBase,
26
21
  )
27
-
28
- from drawlib.v0_1.private.core.model import (
29
- IconStyle,
30
- ImageStyle,
31
- LineStyle,
32
- ShapeStyle,
33
- ShapeTextStyle,
34
- TextStyle,
22
+ from drawlib.v0_1.private.core.dimage import (
23
+ Dimage,
35
24
  )
36
-
37
25
  from drawlib.v0_1.private.core.fonts import (
38
- FontFile,
39
26
  # fonts
40
27
  Font,
41
28
  FontArabic,
42
29
  FontBrahmic,
43
30
  FontChinese,
31
+ FontFile,
44
32
  FontJapanese,
45
33
  FontKorean,
46
34
  FontMonoSpace,
@@ -50,84 +38,70 @@ from drawlib.v0_1.private.core.fonts import (
50
38
  FontSourceCode,
51
39
  FontThai,
52
40
  )
53
-
54
- from drawlib.v0_1.private.core.dimage import (
55
- Dimage,
41
+ from drawlib.v0_1.private.core.model import (
42
+ IconStyle,
43
+ ImageStyle,
44
+ LineStyle,
45
+ ShapeStyle,
46
+ ShapeTextStyle,
47
+ TextStyle,
48
+ )
49
+ from drawlib.v0_1.private.core.theme import (
50
+ dtheme,
56
51
  )
57
-
58
- ######################
59
- ### Canvas Methods ###
60
- ######################
61
-
62
52
  from drawlib.v0_1.private.core_canvas.canvas import (
53
+ # shape patches
54
+ arc,
55
+ # shape original
56
+ arrow,
57
+ chevron,
58
+ circle,
63
59
  # base
64
60
  clear,
65
61
  config,
66
- shape,
62
+ donuts,
63
+ ellipse,
64
+ fan,
67
65
  # image
68
66
  image,
69
67
  # line
70
68
  line,
71
- line_curved,
72
69
  line_bezier1,
73
70
  line_bezier2,
71
+ line_curved,
74
72
  lines,
75
- lines_curved,
76
73
  lines_bezier,
77
- # shape patches
78
- arc,
79
- circle,
80
- ellipse,
74
+ lines_curved,
75
+ parallelogram,
81
76
  polygon,
82
77
  rectangle,
83
78
  regularpolygon,
84
- wedge,
85
- donuts,
86
- fan,
87
- # shape original
88
- arrow,
89
79
  rhombus,
90
- parallelogram,
91
- trapezoid,
92
- triangle,
80
+ # canvas
81
+ save,
82
+ shape,
93
83
  star,
94
- chevron,
95
84
  # text
96
85
  text,
97
86
  text_vertical,
98
- # canvas
99
- save,
87
+ trapezoid,
88
+ triangle,
89
+ wedge,
100
90
  )
101
-
102
-
103
- from drawlib.v0_1.private.icons.util import (
104
- icon,
91
+ from drawlib.v0_1.private.dutil import (
92
+ dutil_canvas,
93
+ dutil_color,
94
+ dutil_script,
95
+ )
96
+ from drawlib.v0_1.private.dutil.settings import (
97
+ dutil_settings,
105
98
  )
106
-
107
99
  from drawlib.v0_1.private.icons import (
108
100
  phosphor as icon_phosphor,
109
101
  )
110
-
111
- ######################
112
- ### Other Drawings ###
113
- ######################
114
-
115
- from drawlib.v0_1.private.core.theme import (
116
- dtheme,
102
+ from drawlib.v0_1.private.icons.util import (
103
+ icon,
117
104
  )
118
105
  from drawlib.v0_1.private.smartarts import (
119
106
  dsart,
120
107
  )
121
-
122
- #################
123
- ### Utilities ###
124
- #################
125
-
126
- from drawlib.v0_1.private.dutil import (
127
- dutil_script,
128
- dutil_canvas,
129
- dutil_color,
130
- )
131
- from drawlib.v0_1.private.dutil.settings import (
132
- dutil_settings,
133
- )
@@ -7,28 +7,28 @@
7
7
  # express or implied, including but not limited to the warranties of
8
8
  # merchantability, fitness for a particular purpose and noninfringement.
9
9
 
10
- # pylint: disable=logging-fstring-interpolation, too-few-public-methods
10
+ # type: ignore
11
11
 
12
12
  """Implementation of drawlib command."""
13
13
 
14
- import os
15
- import sys
16
14
  import argparse
17
- from typing import Optional, List, Literal, Tuple
18
15
  import importlib.util
16
+ import os
17
+ import sys
19
18
  import traceback
19
+ from typing import List, Literal, Optional, Tuple
20
20
 
21
21
  import drawlib
22
22
  import drawlib.v0_1
23
- from drawlib.v0_1.private.logging import logger
23
+ from drawlib.v0_1.private.core_canvas.canvas import clear
24
+ from drawlib.v0_1.private.dutil.dutil_canvas import initialize
24
25
  from drawlib.v0_1.private.dutil.settings import dutil_settings
26
+ from drawlib.v0_1.private.logging import logger
25
27
  from drawlib.v0_1.private.util import (
26
28
  error_handler,
27
29
  get_script_relative_path,
28
30
  purge_font_cache,
29
31
  )
30
- from drawlib.v0_1.private.core_canvas.canvas import clear
31
- from drawlib.v0_1.private.dutil.dutil_canvas import initialize
32
32
 
33
33
 
34
34
  def call() -> None:
@@ -42,7 +42,6 @@ def call() -> None:
42
42
  Raises:
43
43
  ValueError: If an invalid logging mode is specified.
44
44
  """
45
-
46
45
  argparser = DrawlibArgParser()
47
46
  argparser.parse()
48
47
 
@@ -117,7 +116,6 @@ class DrawlibArgParser:
117
116
  Returns:
118
117
  None
119
118
  """
120
-
121
119
  parser = argparse.ArgumentParser(
122
120
  description="Ilustration as code by python",
123
121
  )
@@ -191,7 +189,6 @@ class DrawlibArgParser:
191
189
  Returns:
192
190
  None
193
191
  """
194
-
195
192
  # special options
196
193
  self._name_args, _ = self._parser.parse_known_args()
197
194
 
@@ -209,9 +206,9 @@ class DrawlibArgParser:
209
206
  bool: True if version option is specified, False otherwise.
210
207
 
211
208
  """
212
-
213
209
  if self._name_args is None:
214
210
  self.parse()
211
+
215
212
  return self._name_args.version
216
213
 
217
214
  def is_purge_font_cache(self) -> bool:
@@ -224,9 +221,9 @@ class DrawlibArgParser:
224
221
  bool: True if purge font cache option is specified, False otherwise.
225
222
 
226
223
  """
227
-
228
224
  if self._name_args is None:
229
225
  self.parse()
226
+
230
227
  return self._name_args.purge_font_cache
231
228
 
232
229
  def get_logging_mode(self) -> Literal["quiet", "normal", "verbose", "developer"]:
@@ -243,7 +240,6 @@ class DrawlibArgParser:
243
240
  Returns:
244
241
  Literal["quiet", "normal", "verbose", "developer"]: Logging mode.
245
242
  """
246
-
247
243
  if self._name_args is None:
248
244
  self.parse()
249
245
 
@@ -274,7 +270,6 @@ class DrawlibArgParser:
274
270
  Returns:
275
271
  Literal["none", "auto_clear", "auto_initialize"]: Execution mode.
276
272
  """
277
-
278
273
  if self._name_args is None:
279
274
  self.parse()
280
275
 
@@ -295,7 +290,6 @@ class DrawlibArgParser:
295
290
  Returns:
296
291
  List[str]: List of positional arguments (files and directories).
297
292
  """
298
-
299
293
  if self._positional_args is None:
300
294
  self.parse()
301
295
 
@@ -324,8 +318,7 @@ class DrawlibExecuter:
324
318
  Raises:
325
319
  ValueError: If mode is not one of ["none", "auto_clear", "auto_initialize"].
326
320
  """
327
-
328
- if mode not in ["none", "auto_clear", "auto_initialize"]:
321
+ if mode not in {"none", "auto_clear", "auto_initialize"}:
329
322
  raise ValueError(f'Arg mode is "{mode}". But it must be one of ["none", "auto_clear", "auto_initialize"].')
330
323
  self._mode = mode
331
324
  self._topdir_path: str = ""
@@ -350,7 +343,6 @@ class DrawlibExecuter:
350
343
  ValueError: If the specified path `file_or_directory` does not exist.
351
344
 
352
345
  """
353
-
354
346
  path = get_script_relative_path(file_or_directory)
355
347
  if not os.path.exists(path):
356
348
  raise ValueError(f'"{path}" does not exist')
@@ -383,7 +375,6 @@ class DrawlibExecuter:
383
375
  ValueError: If the specified directory does not have __init__.py, indicating it's not a valid package.
384
376
 
385
377
  """
386
-
387
378
  if os.path.isfile(path):
388
379
  topdir = os.path.dirname(path)
389
380
  else:
@@ -407,7 +398,8 @@ class DrawlibExecuter:
407
398
  logger.info(f' - Parent of package directory "{topdir}" is already in Python Path.')
408
399
  logger.info("")
409
400
 
410
- def _get_python_files(self, directory: str) -> List[str]:
401
+ @staticmethod
402
+ def _get_python_files(directory: str) -> List[str]:
411
403
  """Retrieve all Python files recursively within the specified directory.
412
404
 
413
405
  Recursively searches the specified directory for Python files (*.py) and returns a sorted list
@@ -419,7 +411,6 @@ class DrawlibExecuter:
419
411
  Returns:
420
412
  List[str]: Sorted list of paths to Python files found within the directory.
421
413
  """
422
-
423
414
  python_files: List[str] = []
424
415
  for root, _, files in os.walk(directory):
425
416
  for file in files:
@@ -447,7 +438,6 @@ class DrawlibExecuter:
447
438
  Returns:
448
439
  None
449
440
  """
450
-
451
441
  words = self._get_package_words(file_path)
452
442
  self._load_parent_modules(words)
453
443
 
@@ -479,7 +469,7 @@ class DrawlibExecuter:
479
469
  mspec.loader.exec_module(module) # type: ignore[union-attr]
480
470
  sys.modules[name] = module
481
471
 
482
- except Exception as e: # pylint: disable=broad-exception-caught
472
+ except Exception as e:
483
473
  # Please don't raise again.
484
474
  # Error handler can't detect exact error location of imported module
485
475
  file, line, _, _ = traceback.extract_tb(e.__traceback__)[-1]
@@ -489,7 +479,8 @@ class DrawlibExecuter:
489
479
  logger.debug(traceback.format_exc())
490
480
  sys.exit(1)
491
481
 
492
- def _is_module_loaded(self, module_path: str) -> bool:
482
+ @staticmethod
483
+ def _is_module_loaded(module_path: str) -> bool:
493
484
  """Check if the specified module is already loaded.
494
485
 
495
486
  Checks if the module specified by `module_path` is already loaded in the Python environment.
@@ -500,7 +491,6 @@ class DrawlibExecuter:
500
491
  Returns:
501
492
  bool: True if the module is already loaded, False otherwise.
502
493
  """
503
-
504
494
  # Normalize the module path to ensure consistent comparison
505
495
  module_path = os.path.abspath(module_path)
506
496
 
@@ -518,7 +508,7 @@ class DrawlibExecuter:
518
508
 
519
509
  return False
520
510
 
521
- def _get_package_words(self, file_path):
511
+ def _get_package_words(self, file_path: str) -> List[str]:
522
512
  """Retrieve the package words from the specified file path relative to the top directory.
523
513
 
524
514
  Determines the hierarchical package structure of the specified `file_path` relative to the
@@ -530,7 +520,6 @@ class DrawlibExecuter:
530
520
  Returns:
531
521
  List[str]: List of words representing the package structure.
532
522
  """
533
-
534
523
  last_path = file_path.replace(self._topdir_path, "")
535
524
  words = last_path.split(os.sep)
536
525
  if words[0] == "":
@@ -552,7 +541,6 @@ class DrawlibExecuter:
552
541
  Raises:
553
542
  ValueError: If any parent module directory does not have __init__.py, indicating it's not a valid package.
554
543
  """
555
-
556
544
  for i in range(1, len(words)):
557
545
  name = ".".join(words[:i])
558
546
  if name in sys.modules:
@@ -7,15 +7,13 @@
7
7
  # express or implied, including but not limited to the warranties of
8
8
  # merchantability, fitness for a particular purpose and noninfringement.
9
9
 
10
- # pylint: disable=invalid-name, too-few-public-methods
11
-
12
10
  """Color definition module."""
13
11
 
14
12
  from typing import Final, Tuple
15
13
 
16
14
 
17
15
  class ColorsBase:
18
- """Base class for color-related classes, providing common attributes"""
16
+ """Base class for color-related classes, providing common attributes."""
19
17
 
20
18
  Transparent: Final[Tuple[int, int, int, float]] = (0, 0, 0, 0.0)
21
19