############################################################################
# Copyright 2016 Albin Severinson                                          #
#                                                                          #
# Licensed under the Apache License, Version 2.0 (the "License");          #
# you may not use this file except in compliance with the License.         #
# You may obtain a copy of the License at                                  #
#                                                                          #
#     http://www.apache.org/licenses/LICENSE-2.0                           #
#                                                                          #
# Unless required by applicable law or agreed to in writing, software      #
# distributed under the License is distributed on an "AS IS" BASIS,        #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and      #
# limitations under the License.                                           #
############################################################################

""" This module emulates an assignment solver, but actually loades an
assignment matrix from disk and hands it back. """

import model

class AssignmentLoader(object):
    """ This module emulates an assignment solver, but actually loades an
    assignment matrix from disk and hands it back. """
    def __init__(self, directory):
        """ Create an assignment loader.

        Args:
        directory: Directory to load the assignment from.
        """

        assert isinstance(directory, str)
        self.directory = directory
        return

    def solve(self, par, verbose=False):
        """ Load assignment from disk.

        Args:
        par: System parameters
        verbose: Print extra messages if True

        Returns:
        The loaded assignment
        """

        if verbose:
            print('Loading assignment from', self.directory)

        return model.Assignment.load(par, directory=self.directory)

    @property
    def identifier(self):
        """ Return a string identifier for this object. """
        return self.__class__.__name__

@@ -1149,20 +1149,19 @@
 ######%0A%0A
-%22%22%22 
+'''
 This mod
@@ -1268,26 +1268,90 @@
 ack.
- %22%22%22%0A%0Aimport model
+%0A%0A'''%0A%0Aimport logging%0Aimport model%0Afrom assignments.cached import CachedAssignment
 %0A%0Acl
@@ -1384,20 +1384,19 @@
 t):%0A    
-%22%22%22 
+'''
 This mod
@@ -1503,20 +1503,25 @@
 it back.
- %22%22%22
+%0A%0A    '''
 %0A    def
@@ -1556,20 +1556,19 @@
         
-%22%22%22 
+'''
 Create a
@@ -1595,32 +1595,33 @@
 %0A%0A        Args:%0A
+%0A
         director
@@ -1662,24 +1662,25 @@
 t from.%0A
+%0A
         
 %22%22%22%0A%0A   
@@ -1663,35 +1663,35 @@
  from.%0A%0A        
-%22%22%22
+'''
 %0A%0A        assert
@@ -1796,23 +1796,15 @@
  par
-, verbose=False
+ameters
 ):%0A 
@@ -1810,20 +1810,19 @@
         
-%22%22%22 
+'''
 Load ass
@@ -1855,16 +1855,17 @@
   Args:%0A
+%0A
         
@@ -1890,54 +1890,8 @@
 ters
-%0A        verbose: Print extra messages if True
 %0A%0A  
@@ -1904,24 +1904,16 @@
 Returns:
-%0A       
  The loa
@@ -1927,24 +1927,25 @@
 ignment%0A
+%0A
         
 %22%22%22%0A%0A   
@@ -1936,20 +1936,19 @@
         
-%22%22%22%0A
+'''
 %0A       
@@ -1952,37 +1952,83 @@
     
-if verbose:%0A            print
+assert isinstance(parameters, model.SystemParameters)%0A        logging.debug
 ('Lo
@@ -2048,16 +2048,20 @@
 ent from
+ %25s.
 ', self.
@@ -2067,25 +2067,24 @@
 .directory)%0A
-%0A
         retu
@@ -2086,22 +2086,22 @@
  return 
-model.
+Cached
 Assignme
@@ -2111,16 +2111,23 @@
 load(par
+ameters
 , direct

Use logging module.