Skip to content

Commit

Permalink
util: Add mkdir_p from psamm-import
Browse files Browse the repository at this point in the history
  • Loading branch information
jonls committed Dec 2, 2016
1 parent 3dd78cc commit 52e7d56
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions psamm/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

from __future__ import unicode_literals

import os
import errno
import re
import math
import subprocess
Expand Down Expand Up @@ -184,6 +186,15 @@ def git_try_describe(repo_path):
return None


def mkdir_p(path):
"""Make directory path if it does not already exist."""
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST or not os.path.isdir(path):
raise


def convex_cardinality_relaxed(f, epsilon=1e-5):
"""Transform L1-norm optimization function into cardinality optimization.
Expand Down

0 comments on commit 52e7d56

Please sign in to comment.