From d61e4e7c34fabe6179c8447995d3a9c9dd5a5e27 Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Thu, 31 Jan 2019 18:08:19 -0500 Subject: [PATCH] Refactored (6) Standardized (mostly) how the various classes are initialized. --- bin/cheat | 7 ++----- cheat/sheet.py | 5 +++-- cheat/sheets.py | 8 ++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/bin/cheat b/bin/cheat index a41647b..80cd5f3 100755 --- a/bin/cheat +++ b/bin/cheat @@ -38,7 +38,6 @@ Examples: from __future__ import print_function from cheat.colorize import Colorize from cheat.configuration import Configuration -from cheat.editor import Editor from cheat.sheet import Sheet from cheat.sheets import Sheets from docopt import docopt @@ -53,12 +52,10 @@ if __name__ == '__main__': config.validate() # bootsrap - editor = Editor(config) + sheets = Sheets(config) + sheet = Sheet(config, sheets) colorize = Colorize(config) - sheets = Sheets(config, colorize) - sheet = Sheet(sheets, editor) - # list directories if options['--directories']: print("\n".join(sheets.paths())) diff --git a/cheat/sheet.py b/cheat/sheet.py index 94c7630..e06ace0 100644 --- a/cheat/sheet.py +++ b/cheat/sheet.py @@ -1,3 +1,4 @@ +from cheat.editor import Editor from cheat.utils import Utils import io import os @@ -6,9 +7,9 @@ import shutil class Sheet: - def __init__(self, sheets, editor): + def __init__(self, config, sheets): self._sheets = sheets - self._editor = editor + self._editor = Editor(config) def copy(self, current_sheet_path, new_sheet_path): """ Copies a sheet to a new path """ diff --git a/cheat/sheets.py b/cheat/sheets.py index 2141c1a..2816d4b 100644 --- a/cheat/sheets.py +++ b/cheat/sheets.py @@ -1,14 +1,14 @@ +from cheat.colorize import Colorize +from cheat.utils import Utils import io import os -from cheat.utils import Utils - class Sheets: - def __init__(self, config, colorize): + def __init__(self, config): self._config = config - self._colorize = colorize; + self._colorize = Colorize(config); def default_path(self): """ Returns the default cheatsheet path """