summaryrefslogtreecommitdiff
path: root/gerbonara/cad/kicad/sexp_mapper.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-06-12 18:39:33 +0200
committerjaseg <git@jaseg.de>2023-06-12 18:39:33 +0200
commit35618179036409c71c87746c32a27238260a02a4 (patch)
tree5982cc2556eb110a37ef03288dfe13d7bef841b3 /gerbonara/cad/kicad/sexp_mapper.py
parent03f2ec0a307a33fd9be1da1a65b1dcb569cfcffd (diff)
downloadgerbonara-35618179036409c71c87746c32a27238260a02a4.tar.gz
gerbonara-35618179036409c71c87746c32a27238260a02a4.tar.bz2
gerbonara-35618179036409c71c87746c32a27238260a02a4.zip
Add basic KiCad PCB file format support
Diffstat (limited to 'gerbonara/cad/kicad/sexp_mapper.py')
-rw-r--r--gerbonara/cad/kicad/sexp_mapper.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/gerbonara/cad/kicad/sexp_mapper.py b/gerbonara/cad/kicad/sexp_mapper.py
index 1d0f942..fa5f702 100644
--- a/gerbonara/cad/kicad/sexp_mapper.py
+++ b/gerbonara/cad/kicad/sexp_mapper.py
@@ -64,6 +64,7 @@ def sexp(t, v):
def map_sexp(t, v, parent=None):
if t is not Atom and hasattr(t, '__map__'):
return t.__map__(v, parent=parent)
+
elif t in (int, float, str, Atom):
v, = v
if not isinstance(v, t):
@@ -73,9 +74,11 @@ def map_sexp(t, v, parent=None):
else:
raise TypeError(f'Cannot map s-expression value {v} of type {type(v)} to Python type {t}')
return v
+
elif isinstance(t, list):
t, = t
return [map_sexp(t, elem, parent=parent) for elem in v]
+
else:
raise TypeError(f'Python type {t} has no defined s-expression deserialization')