Skip to content

Commit

Permalink
Add read/write file helpers to Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
funkybob committed Mar 6, 2017
1 parent 0cc51b6 commit 6f9496e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions graaf/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io
import os

import yaml
Expand All @@ -19,6 +20,14 @@ def process(self, src_dir, dest_dir, filename, processor):
'''
raise NotImplementedError

def read_file(self, src_dir, filename):
with io.open(os.path.join(src_dir, filename), mode='r', encoding='utf-8') as fin:
return fin.read()

def write_file(self, dest_dir, filename, content):
with io.open(os.path.join(dest_dir, filename), mode='w', encoding='utf-8') as fout:
fout.write(content)


def get_yaml(src):
'''
Expand Down

0 comments on commit 6f9496e

Please sign in to comment.