Mercurial > hg > GlobalNeighbors
comparison globalneighbors/path.py @ 0:5dba84370182
initial commit; half-working prototype
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Sat, 24 Jun 2017 12:03:39 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:5dba84370182 |
|---|---|
| 1 """ | |
| 2 path related utilities | |
| 3 """ | |
| 4 | |
| 5 def ensure_dir(directory): | |
| 6 """ensure a directory exists""" | |
| 7 if os.path.exists(directory): | |
| 8 if not os.path.isdir(directory): | |
| 9 raise OSError("Not a directory: '{}'".format(directory)) | |
| 10 return directory | |
| 11 os.makedirs(directory) | |
| 12 return directory |
