public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/parser/context/, roverlay/ebuild/, roverlay/
@ 2013-11-14 18:24 André Erdmann
  0 siblings, 0 replies; only message in thread
From: André Erdmann @ 2013-11-14 18:24 UTC (permalink / raw
  To: gentoo-commits

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-14 18:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 18:24 [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/parser/context/, roverlay/ebuild/, roverlay/ André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox