From 5df38c014fd09792995b2b12b1982c535c962c9a Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Thu, 28 Jan 2016 12:19:03 -0500 Subject: Cleanup, rendering fixes. fixed rendering of tented vias fixed rendering of semi-transparent layers fixed file type detection issues added some examples --- gerber/excellon.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gerber/excellon.py') diff --git a/gerber/excellon.py b/gerber/excellon.py index b29f7f0..24715d8 100755 --- a/gerber/excellon.py +++ b/gerber/excellon.py @@ -28,7 +28,7 @@ import operator try: from cStringIO import StringIO -except(ImportError): +except ImportError: from io import StringIO from .excellon_statements import * @@ -57,13 +57,16 @@ def read(filename): return ExcellonParser(settings).parse(filename) -def loads(data): +def loads(data, filename=None): """ Read data from string and return an ExcellonFile Parameters ---------- data : string string containing Excellon file contents + filename : string, optional + string containing the filename of the data source + Returns ------- file : :class:`gerber.excellon.ExcellonFile` @@ -72,7 +75,7 @@ def loads(data): """ # File object should use settings from source file by default. settings = FileSettings(**detect_excellon_format(data)) - return ExcellonParser(settings).parse_raw(data) + return ExcellonParser(settings).parse_raw(data, filename) class DrillHit(object): -- cgit