def column_type_by_name(self, column_type: str) -> CDBColumnType: for db_column_type in self.list: if CFile.file_match(column_type, db_column_type.db_column_type_filter): return db_column_type else: return None
def white_black_valid(self): """ 检查指定文件是否符合白名单, 黑名单验证 """ ds_storage_option = self._ds_storage.value_by_name( 0, 'dstotheroption', None) if ds_storage_option == '' or ds_storage_option is None: return True dir_filter_white_list = CJson.json_attr_value( ds_storage_option, self.Path_SO_Inbound_Filter_Dir_WhiteList, '') dir_filter_black_list = CJson.json_attr_value( ds_storage_option, self.Path_SO_Inbound_Filter_Dir_BlackList, '') file_filter_white_list = CJson.json_attr_value( ds_storage_option, self.Path_SO_Inbound_Filter_File_WhiteList, '') file_filter_black_list = CJson.json_attr_value( ds_storage_option, self.Path_SO_Inbound_Filter_File_BlackList, '') result = True if self.file_type != self.FileType_Unknown: if (dir_filter_white_list != '') and (dir_filter_black_list != ''): result = CFile.file_match( self.file_path_with_rel_path, dir_filter_white_list) and (not CFile.file_match( self.file_path_with_rel_path, dir_filter_black_list)) elif dir_filter_white_list != '': result = CFile.file_match(self.file_path_with_rel_path, dir_filter_white_list) elif dir_filter_black_list != '': result = not CFile.file_match(self.file_path_with_rel_path, dir_filter_black_list) if not result: return result if self.file_type == self.FileType_File: if (file_filter_white_list != '') and (file_filter_black_list != ''): return CFile.file_match( self.file_name_without_path, file_filter_white_list) and (not CFile.file_match( self.file_name_without_path, file_filter_black_list)) elif file_filter_white_list != '': return CFile.file_match(self.file_name_without_path, file_filter_white_list) elif file_filter_black_list != '': return not CFile.file_match(self.file_name_without_path, file_filter_black_list) else: return True else: return True
def classified_by_character_common(self): """ 默认的识别模式 根据文件名的特征, 进行对象类型识别 :return: 返回两个结果 .[0]: 概率, 0-不知道;1-可能是;-1确认是 .[1]: 识别的对象的名称, 如GF1-xxxxxx-000-000 """ self._object_confirm = self.Object_Confirm_IUnKnown sat_classified_character, sat_classified_character_type = self.get_classified_character( ) if sat_classified_character_type == self.TextMatchType_Common: if CFile.file_match(self.get_classified_text(), sat_classified_character): self._object_confirm = self.Object_Confirm_IKnown elif sat_classified_character_type == self.TextMatchType_Regex: if CUtils.text_match_re(self.get_classified_text(), sat_classified_character): self._object_confirm = self.Object_Confirm_IKnown return self._object_confirm, self.classified_object_name()