aboutsummaryrefslogtreecommitdiff
path: root/pomu/util
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-06-17 21:32:53 +0300
committerMykyta Holubakha <hilobakho@gmail.com>2017-06-17 21:32:53 +0300
commit7a1b85d4cf32656f301b29dbb71a2d08c4388d1c (patch)
tree4677f5944825fa61e95c5c95068354c73dbf2dc2 /pomu/util
parentCompleted package sanity checking (diff)
downloadpomu-7a1b85d4cf32656f301b29dbb71a2d08c4388d1c.tar.gz
pomu-7a1b85d4cf32656f301b29dbb71a2d08c4388d1c.tar.bz2
pomu-7a1b85d4cf32656f301b29dbb71a2d08c4388d1c.zip
major refactoring of pomu package source module
fixed Result::unwrap fixed several issues to make the portage package source module produce correct packages
Diffstat (limited to 'pomu/util')
-rw-r--r--pomu/util/result.py4
-rw-r--r--pomu/util/str.py7
2 files changed, 7 insertions, 4 deletions
diff --git a/pomu/util/result.py b/pomu/util/result.py
index a5dae3b..cd67fa0 100644
--- a/pomu/util/result.py
+++ b/pomu/util/result.py
@@ -40,7 +40,7 @@ class Result():
return Result.Err(f(self.err())) if not self._is_val else Result.Ok(self.ok())
def unwrap(self):
- return self.expect(self.err())
+ return self.expect()
def expect(self, msg='Error'):
if self._is_val:
@@ -48,7 +48,7 @@ class Result():
raise ResultException(msg + ': ' + self._val)
def unwrap_err(self):
- return self.expect_err(self.ok())
+ return self.expect_err()
def expect_err(self, msg='Error'):
if not self._is_val:
diff --git a/pomu/util/str.py b/pomu/util/str.py
index 4fcd4ac..419425b 100644
--- a/pomu/util/str.py
+++ b/pomu/util/str.py
@@ -1,2 +1,5 @@
-def pivot(string, idx):
- return (string[:idx], string[idx:])
+def pivot(string, idx, keep_pivot=True):
+ if keep_pivot:
+ return (string[:idx], string[idx:])
+ else:
+ return (string[:idx], string[idx+1:])