From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E7F49138819 for ; Wed, 11 Dec 2013 18:40:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 02CB1E0BA4; Wed, 11 Dec 2013 18:40:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 67135E0BA4 for ; Wed, 11 Dec 2013 18:40:13 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7642633FA6F for ; Wed, 11 Dec 2013 18:40:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id CA7A5D005E for ; Wed, 11 Dec 2013 18:40:08 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1386784613.b6c99cf154217ce3afac99e38bb6417154de6b38.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/strutil.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: b6c99cf154217ce3afac99e38bb6417154de6b38 X-VCS-Branch: master Date: Wed, 11 Dec 2013 18:40:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 0289ad95-8eae-41fe-bedb-f405ceac0196 X-Archives-Hash: c16f55ead8d29eef13541240f92c4724 commit: b6c99cf154217ce3afac99e38bb6417154de6b38 Author: André Erdmann mailerd de> AuthorDate: Wed Dec 11 17:56:53 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Dec 11 17:56:53 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b6c99cf1 roverlay/strutil: foreach_str() --- roverlay/strutil.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roverlay/strutil.py b/roverlay/strutil.py index 10a4360..7569523 100644 --- a/roverlay/strutil.py +++ b/roverlay/strutil.py @@ -7,7 +7,7 @@ """provides utility functions for string manipulation""" __all__ = [ 'ascii_filter', 'bytes_try_decode', 'fix_ebuild_name', - 'pipe_lines', 'shorten_str', 'unquote', + 'pipe_lines', 'shorten_str', 'unquote', 'foreach_str', ] import re @@ -151,3 +151,10 @@ def bytes_try_decode ( else: return byte_str # --- end of bytes_try_decode() --- + +def foreach_str ( func, _str ): + if isinstance ( _str, str ) or not hasattr ( _str, '__iter__' ): + return func ( str ( _str ) ) + else: + return [ func(str(s)) for s in _str ] +# --- end of foreach_str (...) ---