Пример #1
0
 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 {}
Пример #2
0
    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 {}
Пример #3
0
    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 {}
Пример #4
0
 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 {}