INNER CODE UNIT · Python

CustomEncoder

linnabrown/run_dbcan · dbcan/cli/cgc_process_json.py:192

class CustomEncoder(json.JSONEncoder):
    """
    Custom JSON encoder for handling numpy data types.

    This encoder extends `json.JSONEncoder` to provide custom serialization for certain data types not natively supported by the default JSON encoder. Specifically, it converts `numpy.int64` types to strings.

    Methods
    -------
        default(obj): Overrides the default method to provide custom serialization.
    """

    def default(self, obj):
        """
        Provides custom serialization for certain data types.

        Parameters
        ----------
            obj: The object to serialize.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…