• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kimata / my-py-lib / 21092969449

17 Jan 2026 10:39AM UTC coverage: 62.974% (+2.0%) from 60.961%
21092969449

push

github

kimata
refactor: 型安全性向上とコード品質改善(第4弾)

## 主な変更

### センサー
- ADS1015/ADS1115 の重複コードを ads_base.py に統合
- センサー系の型注釈改善

### json_util.py
- iso_pattern の重複定義をモジュールレベル定数に統一
- DateTimeJSONEncoder.default() の type: ignore を削除

### store/mercari
- MercariItem dataclass を導入し、item 辞書を型安全に
- ProgressObserver Protocol の型定義を MercariItem に変更

### store/amazon
- AmazonItem.to_dict() を dataclasses.asdict() で簡潔化

### その他
- flask_util.py の type: ignore を cast() に置換
- lifecycle_manager.py を削除(lifecycle/manager.py に移行済み)
- 各種型注釈・docstring の改善

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

191 of 246 new or added lines in 29 files covered. (77.64%)

112 existing lines in 12 files now uncovered.

3439 of 5461 relevant lines covered (62.97%)

0.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/my_lib/plot_util.py
1
#!/usr/bin/env python3
2
from __future__ import annotations
×
3

4
import functools
×
5
import logging
×
6
import pathlib
×
7

NEW
8
import matplotlib.font_manager  # type: ignore[import-untyped]
×
9

10
import my_lib.panel_config
×
11

12

13
@functools.lru_cache(maxsize=32)
×
14
def _get_font_properties(font_path: pathlib.Path, size: int) -> matplotlib.font_manager.FontProperties:
×
15
    """フォントプロパティをキャッシュ付きで取得"""
16
    return matplotlib.font_manager.FontProperties(fname=str(font_path), size=size)
×
17

18

19
def get_plot_font(
×
20
    font_config: my_lib.panel_config.FontConfigProtocol, font_type: str, size: int
21
) -> matplotlib.font_manager.FontProperties:
22
    """matplotlib 用フォントを取得する
23

24
    Args:
25
        font_config: フォント設定 (path, map を持つ)
26
        font_type: フォントタイプ (例: "jp_bold", "en_medium")
27
        size: フォントサイズ
28

29
    Returns:
30
        matplotlib FontProperties オブジェクト
31
    """
32
    font_path = font_config.path.resolve() / font_config.map[font_type]
×
33

34
    cache_info = _get_font_properties.cache_info()
×
35

36
    result = _get_font_properties(font_path, size)
×
37
    new_cache_info = _get_font_properties.cache_info()
×
38

39
    # キャッシュミスが増えた場合は新しいフォントのロード
40
    if new_cache_info.misses > cache_info.misses:
×
41
        logging.debug("Load font: %s (cached)", font_path)
×
42

43
    return result
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc