From f299a3e8120939f8d81109690f02e9e2dd8849c8 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Thu, 3 Aug 2017 21:23:36 -0700 Subject: [PATCH 1/4] fix mixing spaces and tabs for indentation --- gvanim/animation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gvanim/animation.py b/gvanim/animation.py index 690db27..a907071 100644 --- a/gvanim/animation.py +++ b/gvanim/animation.py @@ -113,7 +113,7 @@ def parse( self, lines ): except KeyError: raise ParseException( 'unrecognized command: {}'.format( action ) ) except TypeError: - raise ParseException( 'wrong number of parameters: {}'.format( line.strip() ) ) + raise ParseException( 'wrong number of parameters: {}'.format( line.strip() ) ) return def steps( self ): From 0dee29f7d9f4865e7f8bdcdcd25b9fe7689e22e6 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Thu, 3 Aug 2017 21:25:49 -0700 Subject: [PATCH 2/4] fix relative imports --- gvanim/__main__.py | 2 +- gvanim/action.py | 2 +- gvanim/animation.py | 2 +- gvanim/jupyter.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gvanim/__main__.py b/gvanim/__main__.py index 8d289fb..24c9dba 100644 --- a/gvanim/__main__.py +++ b/gvanim/__main__.py @@ -18,7 +18,7 @@ from argparse import ArgumentParser, FileType from sys import stdin -import animation, render +from . import animation, render def main(): diff --git a/gvanim/action.py b/gvanim/action.py index e2b0682..cefd5c2 100644 --- a/gvanim/action.py +++ b/gvanim/action.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License along with # "GraphvizAnim". If not, see . -import animation +from . import animation class NextStep( object ): def __init__( self, clean = False ): diff --git a/gvanim/animation.py b/gvanim/animation.py index a907071..bd5c160 100644 --- a/gvanim/animation.py +++ b/gvanim/animation.py @@ -18,7 +18,7 @@ from email.utils import quote import shlex -import action +from . import action class ParseException( Exception ): pass diff --git a/gvanim/jupyter.py b/gvanim/jupyter.py index e07c57d..5645134 100644 --- a/gvanim/jupyter.py +++ b/gvanim/jupyter.py @@ -22,7 +22,7 @@ from IPython.display import Image import ipywidgets as widgets -from render import render +from .render import render def interactive( animation, size = 320 ): basedir = mkdtemp() From 21286fdbb77cca3d82de62d7e827ef05894c4661 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Thu, 3 Aug 2017 21:45:05 -0700 Subject: [PATCH 3/4] ensure input is bytes in Python 3 --- gvanim/render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gvanim/render.py b/gvanim/render.py index a3ec4d7..69aabcd 100644 --- a/gvanim/render.py +++ b/gvanim/render.py @@ -22,7 +22,7 @@ def _render( params ): path, fmt, size, graph = params with open( path , 'w' ) as out: pipe = Popen( [ 'dot', '-Gsize=1,1!', '-Gdpi={}'.format( size ), '-T', fmt ], stdout = out, stdin = PIPE, stderr = None ) - pipe.communicate( input = graph ) + pipe.communicate( input = graph.encode() ) return path def render( graphs, basename, fmt = 'png', size = 320 ): From ad13fed9ba2fd0fa3aa3ec73fb7f5ed76a73f460 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Thu, 3 Aug 2017 21:52:43 -0700 Subject: [PATCH 4/4] break circular import --- gvanim/action.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gvanim/action.py b/gvanim/action.py index cefd5c2..69c7680 100644 --- a/gvanim/action.py +++ b/gvanim/action.py @@ -15,12 +15,11 @@ # You should have received a copy of the GNU General Public License along with # "GraphvizAnim". If not, see . -from . import animation - class NextStep( object ): def __init__( self, clean = False ): self.clean = clean def __call__( self, steps ): + from . import animation steps.append( animation.Step( None if self.clean else steps[ -1 ] ) ) class AddNode( object ):