diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2018-08-24 20:52:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-24 20:52:28 -0400 |
| commit | 1de8487849a3f8f55d126e2687d690226e657fde (patch) | |
| tree | 1bd891b97f8447cb3f513d073d20cea5d4534461 /lib/utils | |
| parent | b3bb975401fe4971170239eea9b928ee13161398 (diff) | |
| parent | 91eb98cc33602f19dddc186c034aed968e048404 (diff) | |
Merge pull request #288 from inkstitch/lexelby/style
fix coding style and enforce style checks in build
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/cache.py | 2 | ||||
| -rw-r--r-- | lib/utils/geometry.py | 5 | ||||
| -rw-r--r-- | lib/utils/inkscape.py | 1 | ||||
| -rw-r--r-- | lib/utils/io.py | 2 |
4 files changed, 8 insertions, 2 deletions
diff --git a/lib/utils/cache.py b/lib/utils/cache.py index 38fe8f2c..3a2636f2 100644 --- a/lib/utils/cache.py +++ b/lib/utils/cache.py @@ -4,5 +4,7 @@ except ImportError: from backports.functools_lru_cache import lru_cache # simplify use of lru_cache decorator + + def cache(*args, **kwargs): return lru_cache(maxsize=None)(*args, **kwargs) diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py index bfdcd3c0..ef5f12b5 100644 --- a/lib/utils/geometry.py +++ b/lib/utils/geometry.py @@ -17,7 +17,7 @@ def cut(line, distance): last_point = p if traveled == distance: return [ - LineString(coords[:i+1]), + LineString(coords[:i + 1]), LineString(coords[i:])] if traveled > distance: cp = line.interpolate(distance) @@ -25,6 +25,7 @@ def cut(line, distance): LineString(coords[:i] + [(cp.x, cp.y)]), LineString([(cp.x, cp.y)] + coords[i:])] + def cut_path(points, length): """Return a subsection of at the start of the path that is length units long. @@ -79,7 +80,7 @@ class Point: if isinstance(other, (int, float)): return self * (1.0 / other) else: - raise ValueErorr("cannot divide Point by %s" % type(other)) + raise ValueError("cannot divide Point by %s" % type(other)) def __repr__(self): return "Point(%s,%s)" % (self.x, self.y) diff --git a/lib/utils/inkscape.py b/lib/utils/inkscape.py index 2d0298bc..a650da69 100644 --- a/lib/utils/inkscape.py +++ b/lib/utils/inkscape.py @@ -1,6 +1,7 @@ from os.path import realpath, expanduser, join as path_join import sys + def guess_inkscape_config_path(): if getattr(sys, 'frozen', None): path = realpath(path_join(sys._MEIPASS, "..", "..", "..")) diff --git a/lib/utils/io.py b/lib/utils/io.py index e5a246f3..f51f629c 100644 --- a/lib/utils/io.py +++ b/lib/utils/io.py @@ -19,6 +19,8 @@ def restore_stderr(): # It's probably possible to generalize this code, but when I tried, # the result was incredibly unreadable. + + def save_stdout(): null = open(os.devnull, 'w') sys.stdout_dup = os.dup(sys.stdout.fileno()) |
