Browse Source

add strip_content_in_paren

quarrying 3 years ago
parent
commit
a68b1b3c63
3 changed files with 13 additions and 2 deletions
  1. 11 0
      khandy/utils_others.py
  2. 1 1
      khandy/version.py
  3. 1 1
      setup.py

+ 11 - 0
khandy/utils_others.py

@@ -1,3 +1,5 @@
+
+import re
 import time
 import json
 import socket
@@ -117,3 +119,12 @@ def save_arguments(filename, args, sort=True):
     args = vars(args)
     with open(filename, 'w') as f:
         json.dump(args, f, indent=4, sort_keys=sort)
+
+
+def strip_content_in_paren(string):
+    """
+    Notes:
+        strip_content_in_paren cannot process nested paren correctly
+    """
+    return re.sub(r"\([^)]*\)|([^)]*)", "", string)
+

+ 1 - 1
khandy/version.py

@@ -1,3 +1,3 @@
-__version__ = '0.1.7'
+__version__ = '0.1.8'
 
 __all__ = ['__version__']

+ 1 - 1
setup.py

@@ -5,7 +5,7 @@ install_requires = ['numpy>=1.11.1', 'opencv-python', 'pillow']
 
 setup(
     name='khandy',
-    version='0.1.7',
+    version='0.1.8',
     description='Handy Utilities for Computer Vision',
     long_description='Handy Utilities for Computer Vision',
     keywords='computer vision',