summaryrefslogtreecommitdiff
path: root/gerber/utils.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 11:42:47 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 11:42:47 -0500
commit1cc20b351c10b1fa19817f29edd8c54a27aeee4b (patch)
treec79265c665c37be7d85677836f9b7761a42fa1e9 /gerber/utils.py
parentd98d23f8b5d61bb9d20e743a3c44bf04b6b2330a (diff)
downloadgerbonara-1cc20b351c10b1fa19817f29edd8c54a27aeee4b.tar.gz
gerbonara-1cc20b351c10b1fa19817f29edd8c54a27aeee4b.tar.bz2
gerbonara-1cc20b351c10b1fa19817f29edd8c54a27aeee4b.zip
tests
Diffstat (limited to 'gerber/utils.py')
-rw-r--r--gerber/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/gerber/utils.py b/gerber/utils.py
index 64cd6ed..86119ba 100644
--- a/gerber/utils.py
+++ b/gerber/utils.py
@@ -220,3 +220,13 @@ def detect_file_format(filename):
elif '%FS' in line:
return'rs274x'
return 'unknown'
+
+
+def validate_coordinates(position):
+ if position is not None:
+ if len(position) != 2:
+ raise TypeError('Position must be a tuple (n=2) of coordinates')
+ else:
+ for coord in position:
+ if not (isinstance(coord, int) or isinstance(coord, float)):
+ raise TypeError('Coordinates must be integers or floats')