From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by gnuweeb.org (Postfix) with ESMTPS id 8770D7E328 for ; Mon, 18 Jul 2022 11:21:02 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NSLMFl8J; dkim-atps=neutral Received: by mail-pf1-f170.google.com with SMTP id l124so10289652pfl.8 for ; Mon, 18 Jul 2022 04:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n5rO+Vzd84wNIyYQ+oUxyiG204SimfHLa7y3zK88QM8=; b=NSLMFl8JKVf3+sSaLURbLWjcy6YZg1UDDbtOCLRaAtIzr1jdlO04tufQz1mup8+2Bt b6fpD6Nyn0006HSSgBYo5FBKWttX67NRlVsy+Z9HqosVKdSgGHSORubLx3m8M2Y5JZgI CZouCdhobI7aL9tOULY1o5qui9AwhyzXTqIP28oNV1kdM3QViLGqjU3qb7FfGPHm0i8j 29AA0V5ThmSuFlWNLrh3UVAjwxU1JIeIovT8cCUgQZGv6LSmvOmYGdX82XmxZEbPkf27 1zlGnNYHeMclFRjOmbyLlibgqek+wzg8dv706t1UD3wV/cxCWCZkOpTYeJNX37ql+1aw AanQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n5rO+Vzd84wNIyYQ+oUxyiG204SimfHLa7y3zK88QM8=; b=aKsoEOLv/OD13bsrH9cY+6K43da2mDYu+rX0DDxchv/fpjyEoWqm+gpMuNM3WhnsHU T2t2jjlf514GlHbsAQKvsmPRqILWd4BHAC/qAlaXDMywknxaeTnUhsBWcXiaiKPs4fMf coBTASOaApCojQdHsAag59nMMUV9kXYmcvoXlTyxLQO4eebOENu55hK7lvnvG3n5sSUi 8HT9m6A3a2SumSyFaEfDQa7LGSaKrSshbrDyW8N15JIKObla6m3wXOzDptMCT7LuKuwi 4CNXbWktwKymrLrwN5VMpjSvMU1dpK7FosoroTpAV1mWdCvmviFibHUFEdrPx4BbaKiA ihvw== X-Gm-Message-State: AJIora/fqGmsj09RcrRD6izd32o1805zuXeEF1IgrFQSR7ozWGNLqVl3 PkTgz+6+tAvCoKgB9R/jwU4j4jYg9RG6CA== X-Google-Smtp-Source: AGRyM1sxSpYl7oXoyjQb4CNmqkJ8Gb/9JL7UqtStN9I7Jd9ieL3l/Gm4q7LZmcSHKv+kILSTK6XRSQ== X-Received: by 2002:a62:442:0:b0:528:641c:cfde with SMTP id 63-20020a620442000000b00528641ccfdemr27857593pfe.14.1658143262055; Mon, 18 Jul 2022 04:21:02 -0700 (PDT) Received: from localhost.localdomain ([101.128.125.134]) by smtp.gmail.com with ESMTPSA id z14-20020aa7948e000000b0052ad6d627a6sm8991072pfk.166.2022.07.18.04.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 04:21:01 -0700 (PDT) From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , GNU/Weeb Mailing List Subject: [PATCH v1 11/11] Recode some codes Date: Mon, 18 Jul 2022 18:20:07 +0700 Message-Id: <20220718112007.792-12-riskimuhammmad1@gmail.com> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220718112007.792-1-riskimuhammmad1@gmail.com> References: <20220718112007.792-1-riskimuhammmad1@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Just recode some codes, I think it much practice and clean (?) Signed-off-by: Muhammad Rizki --- daemon/scraper/utils.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/daemon/scraper/utils.py b/daemon/scraper/utils.py index 3f0d254..5496483 100644 --- a/daemon/scraper/utils.py +++ b/daemon/scraper/utils.py @@ -182,9 +182,8 @@ def create_template(thread: Message, to=None, cc=None): if len(ret) >= 4000: ret = ret[:4000] + "..." - ret = ( - fix_utf8_char(ret) - ) + "\n------------------------------------------------------------------------" + ret = fix_utf8_char(ret) + ret += "\n------------------------------------------------------------------------" return ret, files, is_patch @@ -208,10 +207,9 @@ def prepare_send_patch(mail, text, url): with open(file, "wb") as f: f.write(bytes(text, encoding="utf8")) - caption = ( - "#patch #ml\n" + - fix_utf8_char(cap) - ) + caption = "#patch #ml\n" + caption += fix_utf8_char(cap) + return tmp, file, caption, url -- Muhammad Rizki