old_contents: #!/bin/python3
  """ This script contains the class PasswordManager that is usefull for password
      secure storage.
      This article has been usefull to write this script:
          http://throwingfire.com/storing-passwords-securely/
  
      Author: Julien Delplanque
  """
  import bcrypt
  import json
  
  class PasswordManager(object):
      """ This object allow you to easily manipulate a password database stored
          in a file as a json.
          This json contain username: digest couples.
      """
      def __init__(self, file_path: str):
          """ Initialize the PasswordManager.
              This method does not load the file where the password are stored,
              you have to explicitely call the load method on this object.
  
              Keyword arguments:
              file_path - the path of the password file
          """
          self.password_file_path = file_path
          self.password_dic = {}
  
      def add_user(self, username: str, password: str):
          """ Add a couple of username, password to the database.
              This method does not modify the file, you have to explicitly call
              the write method on this object to modify the file.
  
              Keyword arguments:
              username - the username as a string
              password - the password as a string
          """
          self.password_dic[username] = bcrypt.hashpw(password, bcrypt.gensalt())
  
      def is_correct(self, username: str, password: str):
          """ Determinate if a couple of username, password is correct according
              to the password database.
  
              Keyword arguments:
              username - the username as a string
              password - the password as a string
          """
          if username in self.password_dic.keys():
              expected_digest = self.password_dic[username]
              digest = bcrypt.hashpw(password, self.password_dic[username])
              if digest == expected_digest:
                  return True
          return False
  
      def write(self):
          """ Write the json in the password file.
          """
          with open(self.password_file_path, "w") as password_file:
              password_file.write(json.dumps(self.password_dic))
  
      def load(self):
          """ Read the json from the password file and set the password_dic
              variable according to the json.
          """
          with open(self.password_file_path, "r") as password_file:
              self.password_dic = json.loads(password_file.read())
  
new_contents: #!/bin/python3
  """ This script contains the class PasswordManager that is usefull for password
      secure storage.
      This article has been usefull to write this script:
          http://throwingfire.com/storing-passwords-securely/
  
      Author: Julien Delplanque
  """
  import bcrypt
  import json
  
  class PasswordManager(object):
      """ This object allow you to easily manipulate a password database stored
          in a file as a json.
          This json contain username: digest couples.
      """
      def __init__(self, file_path: str):
          """ Initialize the PasswordManager.
              This method does not load the file where the password are stored,
              you have to explicitely call the load method on this object.
  
              Keyword arguments:
              file_path - the path of the password file
          """
          self.password_file_path = file_path
          self.password_dic = {}
  
      def add_user(self, username: str, password: str):
          """ Add a couple of username, password to the database.
              This method does not modify the file, you have to explicitly call
              the write method on this object to modify the file.
  
              Keyword arguments:
              username - the username as a string
              password - the password as a string
          """
          self.password_dic[username] = str(bcrypt.hashpw(password, bcrypt.gensalt()))
  
      def is_correct(self, username: str, password: str):
          """ Determinate if a couple of username, password is correct according
              to the password database.
  
              Keyword arguments:
              username - the username as a string
              password - the password as a string
          """
          if username in self.password_dic.keys():
              expected_digest = self.password_dic[username]
              digest = bcrypt.hashpw(password, self.password_dic[username])
              if digest == expected_digest:
                  return True
          return False
  
      def write(self):
          """ Write the json in the password file.
          """
          with open(self.password_file_path, "w+") as password_file:
              password_file.write(json.dumps(self.password_dic))
  
      def load(self):
          """ Read the json from the password file and set the password_dic
              variable according to the json.
          """
          with open(self.password_file_path, "r") as password_file:
              self.password_dic = json.loads(password_file.read())
  
subject: Fix methods.