diff options
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/cache.py | 2 | ||||
| -rw-r--r-- | lib/utils/geometry.py | 3 | ||||
| -rw-r--r-- | lib/utils/inkscape.py | 1 | ||||
| -rw-r--r-- | lib/utils/io.py | 2 |
4 files changed, 7 insertions, 1 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..eb1a28fa 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. 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()) |
