Skip to content

Commit

Permalink
removing complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
geramirez committed Feb 2, 2016
1 parent 3206607 commit 8ac6e61
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
25 changes: 16 additions & 9 deletions masonry/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ def get_justifications(self, standard_key, control_key):
})
return justifications

def export_references(self, references, export_dir):
""" Given a list of references in either list or dict format,
determin which references were saved locally and saves those to
the appropriate location in the export directory """
if not export_dir:
return references
relative_base_path = os.path.join(self.system_key, self.component_key)
output_base_path = os.path.join(export_dir, relative_base_path)
utils.create_dir(output_base_path)
def collect_references(self, references, output_base_path, relative_base_path):
for reference in utils.inplace_gen(references):
path = reference.get('path', 'NONE')
file_import_path = os.path.join(self.component_directory, path)
Expand All @@ -90,6 +82,21 @@ def export_references(self, references, export_dir):
# Rename path
file_relative_path = os.path.join(relative_base_path, path)
reference['path'] = file_relative_path

def export_references(self, references, export_dir):
""" Given a list of references in either list or dict format,
determin which references were saved locally and saves those to
the appropriate location in the export directory """
if not export_dir:
return references
relative_base_path = os.path.join(self.system_key, self.component_key)
output_base_path = os.path.join(export_dir, relative_base_path)
utils.create_dir(output_base_path)
self.collect_references(
references=references,
output_base_path=output_base_path,
relative_base_path=relative_base_path
)
return references

def export(self, export_dir=None):
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist= py34, flake8
envlist= py3, flake8

[testenv]
commands=py.test --cov src {posargs}
Expand All @@ -15,5 +15,5 @@ basepython = python3
deps =
flake8
commands =
flake8 src tests --max-line-length=120 --ignore=E731
flake8 src tests --max-line-length=120 --ignore=E731
flake8 masonry tests --max-line-length=120

0 comments on commit 8ac6e61

Please sign in to comment.