def read(self, fp): """ Read the file and return a dictionary. :param fp: An open file descriptor. :type fp: file :return: The parsed file. :rtype: dict """ try: return json.load(fp) except ValueError: return {}
def __call__(self): """ Read the file and return a dictionary. :return: The parsed file. :rtype: dict """ try: fp = self.fp return json.load(fp) except (TypeError, ValueError): return {}