Mercurial > sypikslang
comparison gamelib/data.py @ 1:c90a6586cd66
PEP8-ify skellington (because)
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 06 May 2012 10:32:24 +0200 |
parents | d0de8832774b |
children | 51ff46f42ed2 |
comparison
equal
deleted
inserted
replaced
0:d0de8832774b | 1:c90a6586cd66 |
---|---|
8 import os | 8 import os |
9 | 9 |
10 data_py = os.path.abspath(os.path.dirname(__file__)) | 10 data_py = os.path.abspath(os.path.dirname(__file__)) |
11 data_dir = os.path.normpath(os.path.join(data_py, '..', 'data')) | 11 data_dir = os.path.normpath(os.path.join(data_py, '..', 'data')) |
12 | 12 |
13 | |
13 def filepath(filename): | 14 def filepath(filename): |
14 '''Determine the path to a file in the data directory. | 15 '''Determine the path to a file in the data directory. |
15 ''' | 16 ''' |
16 return os.path.join(data_dir, filename) | 17 return os.path.join(data_dir, filename) |
18 | |
17 | 19 |
18 def load(filename, mode='rb'): | 20 def load(filename, mode='rb'): |
19 '''Open a file in the data directory. | 21 '''Open a file in the data directory. |
20 | 22 |
21 "mode" is passed as the second arg to open(). | 23 "mode" is passed as the second arg to open(). |
22 ''' | 24 ''' |
23 return open(os.path.join(data_dir, filename), mode) | 25 return open(os.path.join(data_dir, filename), mode) |
24 |