(self)
return True
if type(self.repeated_id_process).__name__ != "bool":
        raise ValueError(
            "intersect param's repeated_id_process {} not supported, should be bool type".format(
                self.repeated_id_process))
        self.repeated_id_owner = self.check_and_change_lower(self.repeated_id_owner,
                                                             [consts.GUEST],
                                                             f"{descr}repeated_id_owner")
        if type(self.allow_info_share).__name__ != "bool":
            raise ValueError(
                "intersect param's allow_info_sync {} not supported, should be bool type".format(
                    self.allow_info_share))
        self.info_owner = self.check_and_change_lower(self.info_owner,
                                                      [consts.GUEST, consts.HOST],
                                                      f"{descr}info_owner")
        self.check_boolean(self.with_sample_id, f"{descr}with_sample_id")
if type(self.repeated_id_process).__name__ != "bool":
        raise ValueError(
            "intersect param's repeated_id_process {} not supported, should be bool type".format(
                self.repeated_id_process))
        self.repeated_id_owner = self.check_and_change_lower(self.repeated_id_owner,
                                                             [consts.GUEST],
                                                             f"{descr}repeated_id_owner")
        if type(self.allow_info_share).__name__ != "bool":
            raise ValueError(
                "intersect param's allow_info_sync {} not supported, should be bool type".format(
                    self.allow_info_share))
        self.info_owner = self.check_and_change_lower(self.info_owner,
                                                      [consts.GUEST, consts.HOST],
                                                      f"{descr}info_owner")
        self.check_boolean(self.with_sample_id, f"{descr}with_sample_id")
if type ( self . repeated_id_process ) . __name__ ! = bool : raise ValueError ( intersect param s repeated_id_process {} not supported should be bool type . format ( self . repeated_id_process )) self . repeated_id_owner = self . check_and_change_lower ( self . repeated_id_owner [ consts . GUEST ] f { descr } repeated_id_owner ) if type ( self . allow_info_share ) . __name__ ! = bool : raise ValueError ( intersect param s allow_info_sync {} not supported should be bool type . format ( self . allow_info_share )) self . info_owner = self . check_and_change_lower ( self . info_owner [ consts . GUEST consts . HOST ] f { descr } info_owner ) self . check_boolean ( self . with_sample_id f { descr } with_sample_id )
def check(self):
        descr = "intersect param's "

        self.intersect_method = self.check_and_change_lower(self.intersect_method,
                                                            [consts.RSA, consts.RAW, consts.DH],
                                                            f"{descr}intersect_method")

        self.check_positive_integer(self.random_bit, f"{descr}random_bit")
        self.check_boolean(self.sync_intersect_ids, f"{descr}intersect_ids")
        self.join_role = self.check_and_change_lower(self.join_role,
                                                     [consts.GUEST, consts.HOST],
                                                     f"{descr}join_role")
        self.check_boolean(self.with_encode, f"{descr}with_encode")
        self.check_boolean(self.only_output_key, f"{descr}only_output_key")
        """
        if type(self.repeated_id_process).__name__ != "bool":
        raise ValueError(
            "intersect param's repeated_id_process {} not supported, should be bool type".format(
                self.repeated_id_process))
        self.repeated_id_owner = self.check_and_change_lower(self.repeated_id_owner,
                                                             [consts.GUEST],
                                                             f"{descr}repeated_id_owner")
        if type(self.allow_info_share).__name__ != "bool":
            raise ValueError(
                "intersect param's allow_info_sync {} not supported, should be bool type".format(
                    self.allow_info_share))
        self.info_owner = self.check_and_change_lower(self.info_owner,
                                                      [consts.GUEST, consts.HOST],
                                                      f"{descr}info_owner")
        self.check_boolean(self.with_sample_id, f"{descr}with_sample_id")
        """

        self.join_method = self.check_and_change_lower(self.join_method, [consts.INNER_JOIN, consts.LEFT_JOIN],
                                                       f"{descr}join_method")
        self.check_boolean(self.new_sample_id, f"{descr}new_sample_id")
        self.sample_id_generator = self.check_and_change_lower(self.sample_id_generator,
                                                               [consts.GUEST, consts.HOST],
                                                               f"{descr}sample_id_generator")

        if self.join_method==consts.LEFT_JOIN:
            if not self.sync_intersect_ids:
                raise ValueError(f"Cannot perform left join without sync intersect ids")

        self.check_boolean(self.run_cache, f"{descr} run_cache")
        self.encode_params.check()
        self.raw_params.check()
        self.rsa_params.check()
        self.dh_params.check()
        self.intersect_cache_param.check()
        self.check_boolean(self.cardinality_only, f"{descr}cardinality_only")
        self.check_boolean(self.sync_cardinality, f"{descr}sync_cardinality")
        self.check_boolean(self.run_preprocess, f"{descr}run_preprocess")
        self.intersect_preprocess_params.check()
        if self.cardinality_only:
            if self.intersect_method not in [consts.RSA]:
                raise ValueError(f"cardinality-only mode only support rsa.")
            if self.intersect_method == consts.RSA and self.rsa_params.split_calculation:
                raise ValueError(f"cardinality-only mode only supports unified calculation.")
        if self.run_preprocess:
            if self.intersect_preprocess_params.false_positive_rate < 0.01:
                raise ValueError(f"for preprocessing ids, false_positive_rate must be no less than 0.01")
            if self.cardinality_only:
                raise ValueError(f"cardinality_only mode cannot run preprocessing.")
        if self.run_cache:
            if self.intersect_method not in [consts.RSA, consts.DH]:
                raise ValueError(f"Only rsa or dh method supports cache.")
            if self.intersect_method == consts.RSA and self.rsa_params.split_calculation:
                raise ValueError(f"RSA split_calculation does not support cache.")
            if self.cardinality_only:
                raise ValueError(f"Cache is not available for cardinality_only mode.")
            if self.run_preprocess:
                raise ValueError(f"Preprocessing does not support cache.")
        return True
def check ( self ) : descr = "intersect param's " self . intersect_method = self . check_and_change_lower ( self . intersect_method , [ consts . RSA , consts . RAW , consts . DH ] , f"{descr}intersect_method" ) self . check_positive_integer ( self . random_bit , f"{descr}random_bit" ) self . check_boolean ( self . sync_intersect_ids , f"{descr}intersect_ids" ) self . join_role = self . check_and_change_lower ( self . join_role , [ consts . GUEST , consts . HOST ] , f"{descr}join_role" ) self . check_boolean ( self . with_encode , f"{descr}with_encode" ) self . check_boolean ( self . only_output_key , f"{descr}only_output_key" ) self . join_method = self . check_and_change_lower ( self . join_method , [ consts . INNER_JOIN , consts . LEFT_JOIN ] , f"{descr}join_method" ) self . check_boolean ( self . new_sample_id , f"{descr}new_sample_id" ) self . sample_id_generator = self . check_and_change_lower ( self . sample_id_generator , [ consts . GUEST , consts . HOST ] , f"{descr}sample_id_generator" ) if self . join_method == consts . LEFT_JOIN : if not self . sync_intersect_ids : raise ValueError ( f"Cannot perform left join without sync intersect ids" ) self . check_boolean ( self . run_cache , f"{descr} run_cache" ) self . encode_params . check ( ) self . raw_params . check ( ) self . rsa_params . check ( ) self . dh_params . check ( ) self . intersect_cache_param . check ( ) self . check_boolean ( self . cardinality_only , f"{descr}cardinality_only" ) self . check_boolean ( self . sync_cardinality , f"{descr}sync_cardinality" ) self . check_boolean ( self . run_preprocess , f"{descr}run_preprocess" ) self . intersect_preprocess_params . check ( ) if self . cardinality_only : if self . intersect_method not in [ consts . RSA ] : raise ValueError ( f"cardinality-only mode only support rsa." ) if self . intersect_method == consts . RSA and self . rsa_params . split_calculation : raise ValueError ( f"cardinality-only mode only supports unified calculation." ) if self . run_preprocess : if self . intersect_preprocess_params . false_positive_rate < 0.01 : raise ValueError ( f"for preprocessing ids, false_positive_rate must be no less than 0.01" ) if self . cardinality_only : raise ValueError ( f"cardinality_only mode cannot run preprocessing." ) if self . run_cache : if self . intersect_method not in [ consts . RSA , consts . DH ] : raise ValueError ( f"Only rsa or dh method supports cache." ) if self . intersect_method == consts . RSA and self . rsa_params . split_calculation : raise ValueError ( f"RSA split_calculation does not support cache." ) if self . cardinality_only : raise ValueError ( f"Cache is not available for cardinality_only mode." ) if self . run_preprocess : raise ValueError ( f"Preprocessing does not support cache." ) return True