File tree 9 files changed +55
-13
lines changed
9 files changed +55
-13
lines changed Original file line number Diff line number Diff line change 46
46
runs-on : ${{ matrix.os }}
47
47
steps :
48
48
- uses : actions/checkout@v4
49
+ with :
50
+ submodules : true
49
51
- uses : actions/setup-python@v5
50
52
id : setup-python
51
53
with :
78
80
with :
79
81
fetch-depth : 0
80
82
ref : ${{ github.sha }}
83
+ submodules : true
81
84
82
85
- name : Checkout commit for release
83
86
run : |
Original file line number Diff line number Diff line change
1
+ [submodule "src/esphome_glyphsets/glyphsets "]
2
+ path = src/esphome_glyphsets/glyphsets
3
+ url = https://github.com/googlefonts/glyphsets/
Original file line number Diff line number Diff line change @@ -46,10 +46,6 @@ repos:
46
46
- id : ruff
47
47
args : [--fix, --exit-non-zero-on-fix]
48
48
- id : ruff-format
49
- - repo : https://github.com/codespell-project/codespell
50
- rev : v2.4.1
51
- hooks :
52
- - id : codespell
53
49
- repo : https://github.com/pre-commit/mirrors-mypy
54
50
rev : v1.15.0
55
51
hooks :
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ lint.per-file-ignores."tests/**/*" = [
72
72
]
73
73
lint.isort.known-first-party = [ " esphome_glyphsets" , " tests" ]
74
74
75
+ [tool .setuptools .packages .find ]
76
+ where = [" src" ]
77
+
78
+ [tool .setuptools .package-data ]
79
+ "*" = [" *.yaml" , " *.nam" ]
80
+
75
81
[tool .pytest .ini_options ]
76
82
addopts = """ \
77
83
-v
@@ -81,6 +87,7 @@ addopts = """\
81
87
--cov-report=xml
82
88
"""
83
89
pythonpath = [ " src" ]
90
+ testpaths = " tests/"
84
91
85
92
[tool .coverage .run ]
86
93
branch = true
Original file line number Diff line number Diff line change 1
1
__version__ = "0.0.1"
2
+
3
+ import pathlib
4
+
5
+ FILE_PATH = pathlib .Path (__file__ ).resolve ()
6
+ GLYPHSETS_BASE_PATH = FILE_PATH .parent / "glyphsets" / "Lib" / "glyphsets"
7
+ GLYPHSETS_DEFINITIONS_PATH = GLYPHSETS_BASE_PATH / "definitions"
8
+ GLYPHSETS_NAM_PATH = GLYPHSETS_BASE_PATH / "results" / "nam"
9
+
10
+
11
+ def defined_glyphsets () -> list [str ]:
12
+ """Return a list of defined glyphsets."""
13
+ return sorted (
14
+ f .stem
15
+ for f in GLYPHSETS_DEFINITIONS_PATH .iterdir ()
16
+ if f .is_file () and f .suffix == ".yaml"
17
+ )
18
+
19
+
20
+ def unicodes_per_glyphset (glyphset_name : str ) -> list [int ]:
21
+ """Return a list of unicodes for a given glyphset."""
22
+ nam_path = GLYPHSETS_NAM_PATH / f"{ glyphset_name } .nam"
23
+ if not nam_path .exists ():
24
+ return []
25
+ character_set : set [int ] = set ()
26
+ for line in nam_path .read_text ().splitlines ():
27
+ unicode = line .partition (" " )[0 ]
28
+ if unicode .startswith ("0x" ):
29
+ character_set .add (int (unicode [2 :], 16 ))
30
+ return sorted (character_set )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ from esphome_glyphsets import defined_glyphsets , unicodes_per_glyphset
2
+
3
+
4
+ def test_defined_glyphsets () -> None :
5
+ """Test defined_glyphsets."""
6
+ assert "GF_Latin_Core" in defined_glyphsets ()
7
+
8
+
9
+ def test_unicodes_per_glyphset () -> None :
10
+ """Test unicodes_per_glyphset."""
11
+ assert unicodes_per_glyphset ("GF_Latin_Core" )
12
+ assert not unicodes_per_glyphset ("GF_Latin_Core_Invalid" )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments