From 5507494a350bd602d47dd69bd2bde90a3de43590 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 1 Sep 2013 16:04:50 -0500 Subject: move mkdir_p out of gfx.py and into helpers.py It seems that mkdir_p is unused at the moment. --- pokemontools/gfx.py | 12 ------------ pokemontools/helpers.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pokemontools/gfx.py b/pokemontools/gfx.py index cedbced..c7c6bec 100644 --- a/pokemontools/gfx.py +++ b/pokemontools/gfx.py @@ -12,18 +12,6 @@ import trainers if __name__ != "__main__": rom = crystal.load_rom() -def mkdir_p(path): - """ - Make a directory at a given path. - """ - try: - os.makedirs(path) - except OSError as exc: # Python >2.5 - if exc.errno == errno.EEXIST: - pass - else: raise - - def hex_dump(input, debug=True): """ Display hex dump in rows of 16 bytes. diff --git a/pokemontools/helpers.py b/pokemontools/helpers.py index 42cec87..17e7a74 100644 --- a/pokemontools/helpers.py +++ b/pokemontools/helpers.py @@ -1,6 +1,7 @@ """ Generic functions that should be reusable anywhere in pokemontools. """ +import os def index(seq, f): """return the index of the first item in seq @@ -27,3 +28,14 @@ def flattener(x): def flatten(x): "flattens a list of sublists into just one list" return list(flattener(x)) + +def mkdir_p(path): + """ + Make a directory at a given path. + """ + try: + os.makedirs(path) + except OSError as exc: # Python >2.5 + if exc.errno == errno.EEXIST: + pass + else: raise -- cgit v1.2.3