From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/parser/context/, roverlay/ebuild/, roverlay/
Date: Thu, 14 Nov 2013 18:24:22 +0000 (UTC) [thread overview]
Message-ID: <1384031311.b471d0b9a15be64098cdf58e33da4d047aafa124.dywi@gentoo> (raw)
commit: b471d0b9a15be64098cdf58e33da4d047aafa124
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Nov 9 21:04:00 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Nov 9 21:08:31 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b471d0b9
roverlay/strutil.py: remove split_whitespace()
<str>.split() / <str>.split(None) is more readable (and _maybe_ faster).
---
roverlay/ebuild/useflagmap.py | 5 ++---
roverlay/packagerules/parser/context/action.py | 4 ++--
roverlay/packagerules/parser/context/match.py | 2 +-
roverlay/strutil.py | 6 +-----
4 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/roverlay/ebuild/useflagmap.py b/roverlay/ebuild/useflagmap.py
index 8b5d7a6..5688579 100644
--- a/roverlay/ebuild/useflagmap.py
+++ b/roverlay/ebuild/useflagmap.py
@@ -5,7 +5,6 @@
# either version 2 of the License, or (at your option) any later version.
import roverlay.util
-import roverlay.strutil
__all__ = [ 'UseFlagAliasMap', 'UseFlagRenameMap', ]
@@ -48,12 +47,12 @@ class _UseFlagMapBase ( dict ):
pass
elif sline [0] != line [0]:
# append to last flag
- alias = roverlay.strutil.split_whitespace ( sline )
+ alias = sline.split ( None )
if alias:
self.add_entry ( current_flag, alias )
else:
next_flag, alias = roverlay.util.headtail (
- roverlay.strutil.split_whitespace ( sline )
+ sline.split ( None )
)
next_flag = next_flag.lower()
if not next_flag or next_flag == '=':
diff --git a/roverlay/packagerules/parser/context/action.py b/roverlay/packagerules/parser/context/action.py
index eafcfa6..bb1a001 100644
--- a/roverlay/packagerules/parser/context/action.py
+++ b/roverlay/packagerules/parser/context/action.py
@@ -175,7 +175,7 @@ class RuleActionContext (
if not sepa:
# get key from argstr
- argv = roverlay.strutil.split_whitespace ( argstr, maxsplit=1 )
+ argv = argstr.split ( None, 1 )
if argv:
key = roverlay.strutil.unquote ( argv [0].lower() )
if not key:
@@ -340,7 +340,7 @@ class RuleActionContext (
)
else:
# split _str into (<keyword>,<value>)
- argv = roverlay.strutil.split_whitespace ( _str, maxsplit=1 )
+ argv = _str.split ( None, 1 )
if argv [0] in self.KEYWORDS_ACTION_TRACE:
if len ( argv ) > 1 and argv [1]:
diff --git a/roverlay/packagerules/parser/context/match.py b/roverlay/packagerules/parser/context/match.py
index 00fa0e6..e1bcf0e 100644
--- a/roverlay/packagerules/parser/context/match.py
+++ b/roverlay/packagerules/parser/context/match.py
@@ -195,7 +195,7 @@ class RuleMatchContext (
# child RuleMatchContexts as inactive
self.get_nested()._active = False
- argv = roverlay.strutil.split_whitespace ( s )
+ argv = s.split ( None )
argc = len ( argv )
diff --git a/roverlay/strutil.py b/roverlay/strutil.py
index a8e4361..d5876b0 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', 'split_whitespace',
+ 'pipe_lines', 'shorten_str', 'unquote',
]
import re
@@ -17,11 +17,7 @@ _DEFAULT_ENCODINGS = ( 'utf-8', 'ascii', 'iso8859_15', 'utf-16', 'latin_1' )
_EBUILD_NAME_ILLEGAL_CHARS = re.compile ( "[.:]{1,}" )
_EBUILD_NAME_ILLEGAL_CHARS_REPLACE_BY = '_'
-_WHITESPACE = re.compile ( '\s+' )
-def split_whitespace ( _str, **kwargs ):
- return _WHITESPACE.split ( _str, **kwargs )
-# --- end of split_whitespace (...) ---
def wildcard_to_regex ( _str, unsafe ):
# TODO: find a function that is more efficient
reply other threads:[~2013-11-14 18:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384031311.b471d0b9a15be64098cdf58e33da4d047aafa124.dywi@gentoo \
--to=dywi@mailerd.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox