Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13", "3.14"]

runs-on: ${{ matrix.os }}

Expand Down
6 changes: 1 addition & 5 deletions kalamine/layout.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import copy
import sys
import tomllib
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional, Set, Type, TypeVar

try:
import tomllib
except ImportError:
import tomli as tomllib

import click
import yaml

Expand Down
6 changes: 4 additions & 2 deletions kalamine/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ def send(
elif self.path == "/xkb_symbols":
send(xkb.xkb_symbols(kb_layout))
elif self.path == "/svg":
utf8 = ET.tostring(web.svg(kb_layout).getroot(), encoding="unicode")
send(utf8, content="image/svg+xml")
root_element = web.svg(kb_layout).getroot()
if root_element is not None:
utf8 = ET.tostring(root_element, encoding="unicode")
send(utf8, content="image/svg+xml")
elif self.path == "/":
kb_layout = KeyboardLayout(load_layout(file_path), angle_mod) # refresh
send(main_page(kb_layout, angle_mod), content="text/html")
Expand Down
14 changes: 9 additions & 5 deletions kalamine/xkb_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ def list_symbols(xkb_root: Path, xml_index: XmlIndex) -> XmlIndex:
#


def get_rules_variant_list(
tree: ET.ElementTree, locale: LocaleName
) -> Optional[ET.Element]:
# XXX Getting a strange MyPy error here => deactivate the type checking :-(

# def get_rules_variant_list(
# tree: ET.ElementTree, locale: LocaleName)
# ) -> Optional[ET.Element]:


def get_rules_variant_list(tree, locale: LocaleName) -> Optional[ET.Element]:
"""Find the <layout/variantList> item matching the locale."""

query = f'.//layout/configItem/name[.="{locale}"]/../../variantList'
Expand Down Expand Up @@ -396,8 +401,7 @@ def update_rules(xkb_root: Path, kbd_index: KbdIndex) -> None:
description = layout.meta["description"]
add_rules_variant(vlist, name, description)

if hasattr(ET, "indent"): # Python 3.9+
ET.indent(tree)
ET.indent(tree)

with filepath.open("w") as file:
file.write(XKB_RULES_HEADER)
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]

requires-python = ">= 3.9"
requires-python = ">= 3.11"
dependencies = [
"click>=8.0",
"livereload",
"pyyaml",
"tomli;python_version<'3.11'",
"progress",
]

Expand All @@ -55,5 +54,5 @@ wkalamine = "kalamine.cli_msklc:cli"
extend-select = ["I"]

[tool.mypy]
module = ["progress.bar"]
# module = ["progress.bar"]
ignore_missing_imports = true
5 changes: 1 addition & 4 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
from pathlib import Path
from typing import Dict

try:
import tomllib
except ImportError:
import tomli as tomllib
import tomllib


def get_layout_dict(filename: str) -> Dict:
Expand Down
825 changes: 310 additions & 515 deletions uv.lock

Large diffs are not rendered by default.

Loading