changeset 39058:31639c8e63d4

style: prefer using a single underscore
author Dmitry Selyutin <ghostmansd@gmail.com>
date Sun, 22 Oct 2017 23:13:50 +0300
parents 7fa8623f1338
children f6aa07d1cc45
files pygnulib/config.py pygnulib/generator.py pygnulib/module.py pygnulib/parser.py pygnulib/vfs.py
diffstat 5 files changed, 497 insertions(+), 495 deletions(-) [+]
line wrap: on
line diff
--- a/pygnulib/config.py	Sun Oct 22 22:43:46 2017 +0300
+++ b/pygnulib/config.py	Sun Oct 22 23:13:50 2017 +0300
@@ -4,22 +4,23 @@
 
 
 
-import codecs as _codecs_
-import os as _os_
-import re as _re_
+import codecs as _codecs
+import os as _os
+import re as _re
 
 
-from .error import type_assert as _type_assert_
-from .error import AutoconfVersionError as _AutoconfVersionError_
-from .error import M4BaseMismatchError as _M4BaseMismatchError_
+from .error import type_assert as _type_assert
+from .error import AutoconfVersionError as _AutoconfVersionError
+from .error import M4BaseMismatchError as _M4BaseMismatchError
 
 
 
-def _regex_(regex):
-    return _re_.compile(regex, _re_.S | _re_.M)
+def _compile(regex):
+    return _re.compile(regex, _re.S | _re.M)
 
 
-_ITERABLES_ = (list, tuple, set, frozenset)
+_ITERABLES = (list, tuple, set, frozenset)
+
 
 
 LGPLv2_LICENSE = frozenset({"LGPLv2", "LGPLv2+"})
@@ -39,7 +40,7 @@
 
 class Base:
     """gnulib generic configuration"""
-    _TABLE_ = {
+    _TABLE = {
         "root"              : ".",
         "local"             : "",
         "source_base"       : "lib",
@@ -64,7 +65,7 @@
         "copymode"          : None,
         "local_copymode"    : None,
     }
-    _OPTIONS_ = frozenset({
+    _OPTIONS = frozenset({
         "tests",
         "obsolete",
         "cxx_tests",
@@ -74,7 +75,7 @@
     })
 
 
-    class _Option_:
+    class _Option:
         """gnulib configuration options"""
         Obsolete = (1 << 0)
         Tests = (1 << 1)
@@ -88,7 +89,7 @@
 
     def __init__(self, **kwargs):
         self.__table = {"options": 0}
-        for (key, value) in Base._TABLE_.items():
+        for (key, value) in Base._TABLE.items():
             self[key] = kwargs.get(key, value)
 
 
@@ -109,10 +110,10 @@
 
     @root.setter
     def root(self, value):
-        _type_assert_("root", value, str)
+        _type_assert("root", value, str)
         if not value:
             raise ValueError("non-empty path not allowed")
-        self.__table["root"] = _os_.path.normpath(value)
+        self.__table["root"] = _os.path.normpath(value)
 
 
     @property
@@ -122,8 +123,8 @@
 
     @local.setter
     def local(self, value):
-        _type_assert_("local", value, str)
-        self.__table["local"] = _os_.path.normpath(value) if value else ""
+        _type_assert("local", value, str)
+        self.__table["local"] = _os.path.normpath(value) if value else ""
 
 
     @property
@@ -133,11 +134,11 @@
 
     @source_base.setter
     def source_base(self, value):
-        _type_assert_("source_base", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("source_base", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("source_base cannot be an absolute path")
-        self.__table["source_base"] = _os_.path.normpath(value) if value else "lib"
+        self.__table["source_base"] = _os.path.normpath(value) if value else "lib"
 
 
     @property
@@ -147,11 +148,11 @@
 
     @m4_base.setter
     def m4_base(self, value):
-        _type_assert_("m4_base", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("m4_base", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("m4_base cannot be an absolute path")
-        self.__table["m4_base"] = _os_.path.normpath(value) if value else "m4"
+        self.__table["m4_base"] = _os.path.normpath(value) if value else "m4"
 
 
     @property
@@ -161,11 +162,11 @@
 
     @po_base.setter
     def po_base(self, value):
-        _type_assert_("po_base", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("po_base", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("po_base cannot be an absolute path")
-        self.__table["po_base"] = _os_.path.normpath(value) if value else "po"
+        self.__table["po_base"] = _os.path.normpath(value) if value else "po"
 
 
     @property
@@ -175,11 +176,11 @@
 
     @doc_base.setter
     def doc_base(self, value):
-        _type_assert_("doc_base", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("doc_base", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("doc_base cannot be an absolute path")
-        self.__table["doc_base"] = _os_.path.normpath(value) if value else "doc"
+        self.__table["doc_base"] = _os.path.normpath(value) if value else "doc"
 
 
     @property
@@ -189,11 +190,11 @@
 
     @tests_base.setter
     def tests_base(self, value):
-        _type_assert_("tests_base", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("tests_base", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("tests_base cannot be an absolute path")
-        self.__table["tests_base"] = _os_.path.normpath(value) if value else "tests"
+        self.__table["tests_base"] = _os.path.normpath(value) if value else "tests"
 
 
     @property
@@ -203,11 +204,11 @@
 
     @auxdir.setter
     def auxdir(self, value):
-        _type_assert_("auxdir", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("auxdir", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("auxdir cannot be an absolute path")
-        self.__table["auxdir"] = _os_.path.normpath(value) if value else "build-aux"
+        self.__table["auxdir"] = _os.path.normpath(value) if value else "build-aux"
 
 
     @property
@@ -217,7 +218,7 @@
 
     @lib.setter
     def lib(self, value):
-        _type_assert_("lib", value, str)
+        _type_assert("lib", value, str)
         self.__table["lib"] = value if value else "libgnu"
 
 
@@ -228,9 +229,9 @@
 
     @makefile_name.setter
     def makefile_name(self, value):
-        _type_assert_("makefile_name", value, str)
-        value = _os_.path.normpath(value)
-        if _os_.path.isabs(value):
+        _type_assert("makefile_name", value, str)
+        value = _os.path.normpath(value)
+        if _os.path.isabs(value):
             return ValueError("makefile_name cannot be an absolute path")
         self.__table["makefile_name"] = value
 
@@ -245,7 +246,7 @@
 
     @macro_prefix.setter
     def macro_prefix(self, value):
-        _type_assert_("macro_prefix", value, str)
+        _type_assert("macro_prefix", value, str)
         self.__table["macro_prefix"] = value
 
 
@@ -256,7 +257,7 @@
 
     @po_domain.setter
     def po_domain(self, value):
-        _type_assert_("po_base", value, str)
+        _type_assert("po_base", value, str)
         self.__table["po_base"] = value
 
 
@@ -267,7 +268,7 @@
 
     @witness_c_macro.setter
     def witness_c_macro(self, value):
-        _type_assert_("witness_c_macro", value, str)
+        _type_assert("witness_c_macro", value, str)
         self.__table["witness_c_macro"] = value
 
 
@@ -278,10 +279,10 @@
 
     @licenses.setter
     def licenses(self, value):
-        _type_assert_("licenses", value, _ITERABLES_)
+        _type_assert("licenses", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("license", item, str)
+            _type_assert("license", item, str)
             result.add(item)
         self.__table["licenses"] = frozenset(result)
 
@@ -289,98 +290,98 @@
     @property
     def tests(self):
         """include unit tests for the included modules"""
-        return bool(self.__table["options"] & Base._Option_.Tests)
+        return bool(self.__table["options"] & Base._Option.Tests)
 
     @tests.setter
     def tests(self, value):
-        _type_assert_("tests", value, bool)
+        _type_assert("tests", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.Tests
+            self.__table["options"] |= Base._Option.Tests
         else:
-            self.__table["options"] &= ~Base._Option_.Tests
+            self.__table["options"] &= ~Base._Option.Tests
 
 
     @property
     def obsolete(self):
         """include obsolete modules when they occur among the modules"""
-        return bool(self.__table["options"] & Base._Option_.Tests)
+        return bool(self.__table["options"] & Base._Option.Tests)
 
     @obsolete.setter
     def obsolete(self, value):
-        _type_assert_("obsolete", value, bool)
+        _type_assert("obsolete", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.Obsolete
+            self.__table["options"] |= Base._Option.Obsolete
         else:
-            self.__table["options"] &= ~Base._Option_.Obsolete
+            self.__table["options"] &= ~Base._Option.Obsolete
 
 
     @property
     def cxx_tests(self):
         """include even unit tests for C++ interoperability"""
-        return bool(self.__table["options"] & Base._Option_.CXX)
+        return bool(self.__table["options"] & Base._Option.CXX)
 
     @cxx_tests.setter
     def cxx_tests(self, value):
-        _type_assert_("cxx_tests", value, bool)
+        _type_assert("cxx_tests", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.CXX
+            self.__table["options"] |= Base._Option.CXX
         else:
-            self.__table["options"] &= ~Base._Option_.CXX
+            self.__table["options"] &= ~Base._Option.CXX
 
 
     @property
     def longrunning_tests(self):
         """include even unit tests that are long-runners"""
-        return bool(self.__table["options"] & Base._Option_.Longrunning)
+        return bool(self.__table["options"] & Base._Option.Longrunning)
 
     @longrunning_tests.setter
     def longrunning_tests(self, value):
-        _type_assert_("longrunning_tests", value, bool)
+        _type_assert("longrunning_tests", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.Longrunning
+            self.__table["options"] |= Base._Option.Longrunning
         else:
-            self.__table["options"] &= ~Base._Option_.Longrunning
+            self.__table["options"] &= ~Base._Option.Longrunning
 
 
     @property
     def privileged_tests(self):
         """include even unit tests that require root privileges"""
-        return bool(self.__table["options"] & Base._Option_.Privileged)
+        return bool(self.__table["options"] & Base._Option.Privileged)
 
     @privileged_tests.setter
     def privileged_tests(self, value):
-        _type_assert_("privileged_tests", value, bool)
+        _type_assert("privileged_tests", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.Privileged
+            self.__table["options"] |= Base._Option.Privileged
         else:
-            self.__table["options"] &= ~Base._Option_.Privileged
+            self.__table["options"] &= ~Base._Option.Privileged
 
 
     @property
     def unportable_tests(self):
         """include even unit tests that fail on some platforms"""
-        return bool(self.__table["options"] & Base._Option_.Unportable)
+        return bool(self.__table["options"] & Base._Option.Unportable)
 
     @unportable_tests.setter
     def unportable_tests(self, value):
-        _type_assert_("unportable_tests", value, bool)
+        _type_assert("unportable_tests", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.Unportable
+            self.__table["options"] |= Base._Option.Unportable
         else:
-            self.__table["options"] &= ~Base._Option_.Unportable
+            self.__table["options"] &= ~Base._Option.Unportable
 
 
     @property
     def all_tests(self):
         """include all kinds of problematic unit tests"""
-        return (self.__table["options"] & Base._Option_.AllTests) == Base._Option_.AllTests
+        return (self.__table["options"] & Base._Option.AllTests) == Base._Option.AllTests
 
     @all_tests.setter
     def all_tests(self, value):
         if value:
-            self.__table["options"] |= Base._Option_.AllTests
+            self.__table["options"] |= Base._Option.AllTests
         else:
-            self.__table["options"] &= Base._Option_.AllTests
+            self.__table["options"] &= Base._Option.AllTests
 
 
     @property
@@ -390,7 +391,7 @@
 
     @libtool.setter
     def libtool(self, value):
-        _type_assert_("libtool", value, bool)
+        _type_assert("libtool", value, bool)
         self.__table["libtool"] = value
 
 
@@ -401,7 +402,7 @@
 
     @conddeps.setter
     def conddeps(self, value):
-        _type_assert_("conddeps", value, bool)
+        _type_assert("conddeps", value, bool)
         self.__table["conddeps"] = value
 
 
@@ -412,7 +413,7 @@
 
     @vc_files.setter
     def vc_files(self, value):
-        _type_assert_("vc_files", value, bool)
+        _type_assert("vc_files", value, bool)
         self.__table["vc_files"] = value
 
 
@@ -425,9 +426,9 @@
     def ac_version(self, value):
         if isinstance(value, str):
             value = float(value)
-        _type_assert_("ac_version", value, float)
+        _type_assert("ac_version", value, float)
         if value < 2.59:
-            raise _AutoconfVersionError_(2.59)
+            raise _AutoconfVersionError(2.59)
         self.__table["ac_version"] = value
 
 
@@ -438,10 +439,10 @@
 
     @modules.setter
     def modules(self, value):
-        _type_assert_("modules", value, _ITERABLES_)
+        _type_assert("modules", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("module", item, str)
+            _type_assert("module", item, str)
             result.add(item)
         self.__table["modules"] = frozenset(result)
 
@@ -453,10 +454,10 @@
 
     @avoid.setter
     def avoid(self, value):
-        _type_assert_("avoid", value, _ITERABLES_)
+        _type_assert("avoid", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("avoid", item, str)
+            _type_assert("avoid", item, str)
             result.add(item)
         self.__table["avoid"] = frozenset(result)
 
@@ -468,10 +469,10 @@
 
     @files.setter
     def files(self, value):
-        _type_assert_("files", value, _ITERABLES_)
+        _type_assert("files", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("file", item, str)
+            _type_assert("file", item, str)
             result.add(item)
         self.__table["files"] = frozenset(result)
 
@@ -480,7 +481,7 @@
     def include_guard_prefix(self):
         """include guard prefix"""
         prefix = self.__table["macro_prefix"].upper()
-        default = Base._TABLE_["macro_prefix"].upper()
+        default = Base._TABLE["macro_prefix"].upper()
         return "GL_{0}".format(prefix) if prefix == default else "GL"
 
 
@@ -511,19 +512,19 @@
     @property
     def copyrights(self):
         """update the license copyright text"""
-        return bool(self.__table["options"] & Base._Option_.Copyrights)
+        return bool(self.__table["options"] & Base._Option.Copyrights)
 
     @copyrights.setter
     def copyrights(self, value):
-        _type_assert_("copyrights", value, bool)
+        _type_assert("copyrights", value, bool)
         if value:
-            self.__table["options"] |= Base._Option_.Copyrights
+            self.__table["options"] |= Base._Option.Copyrights
         else:
-            self.__table["options"] &= ~Base._Option_.Copyrights
+            self.__table["options"] &= ~Base._Option.Copyrights
 
 
     def __getitem__(self, key):
-        table = (set(Base._TABLE_.keys()) | Base._OPTIONS_)
+        table = (set(Base._TABLE.keys()) | Base._OPTIONS)
         if key not in table:
             key = key.replace("-", "_")
             if key not in table:
@@ -532,7 +533,7 @@
 
 
     def __setitem__(self, key, value):
-        table = (set(Base._TABLE_.keys()) | Base._OPTIONS_)
+        table = (set(Base._TABLE.keys()) | Base._OPTIONS)
         if key not in table:
             key = key.replace("_", "-")
             if key not in table:
@@ -558,49 +559,49 @@
 
 class Cache(Base):
     """gnulib cached configuration"""
-    _COMMENTS_ = _regex_(r"((?:(?:#)|(?:^dnl\s+)|(?:\s+dnl\s+)).*?)$")
-    _AUTOCONF_ = {
-        "ac_version" : _regex_(r"AC_PREREQ\(\[(.*?)\]\)"),
-        "auxdir"   : _regex_(r"AC_CONFIG_AUX_DIR\(\[(.*?)\]\)$"),
-        "libtool"  : _regex_(r"A[CM]_PROG_LIBTOOL")
+    _COMMENTS = _compile(r"((?:(?:#)|(?:^dnl\s+)|(?:\s+dnl\s+)).*?)$")
+    _AUTOCONF = {
+        "ac_version" : _compile(r"AC_PREREQ\(\[(.*?)\]\)"),
+        "auxdir"   : _compile(r"AC_CONFIG_AUX_DIR\(\[(.*?)\]\)$"),
+        "libtool"  : _compile(r"A[CM]_PROG_LIBTOOL")
     }
-    _GNULIB_CACHE_ = {
-        "local"             : (str, _regex_(r"gl_LOCAL_DIR\(\[(.*?)\]\)")),
-        "libtool"           : (bool, _regex_(r"gl_LIBTOOL\(\[(.*?)\]\)")),
-        "conddeps"          : (bool, _regex_(r"gl_CONDITIONAL_DEPENDENCIES\(\[(.*?)\]\)")),
-        "vc_files"          : (bool, _regex_(r"gl_VC_FILES\(\[(.*?)\]\)")),
-        "tests"             : (bool, _regex_(r"gl_WITH_TESTS\(\[(.*?)\]\)")),
-        "obsolete"          : (bool, _regex_(r"gl_WITH_OBSOLETE\(\[(.*?)\]\)")),
-        "cxx_tests"         : (bool, _regex_(r"gl_WITH_CXX_TESTS\(\[(.*?)\]\)")),
-        "longrunning_tests" : (bool, _regex_(r"gl_WITH_LONGRUNNING_TESTS\(\[(.*?)\]\)")),
-        "privileged_tests"  : (bool, _regex_(r"gl_WITH_PRIVILEGED_TESTS\(\[(.*?)\]\)")),
-        "unportable_tests"  : (bool, _regex_(r"gl_WITH_UNPORTABLE_TESTS\(\[(.*?)\]\)")),
-        "all_tests"         : (bool, _regex_(r"gl_WITH_ALL_TESTS\(\[(.*?)\]\)")),
-        "source_base"       : (str, _regex_(r"gl_SOURCE_BASE\(\[(.*?)\]\)")),
-        "m4_base"           : (str, _regex_(r"gl_M4_BASE\(\[(.*?)\]\)")),
-        "po_base"           : (str, _regex_(r"gl_PO_BASE\(\[(.*?)\]\)")),
-        "doc_base"          : (str, _regex_(r"gl_DOC_BASE\(\[(.*?)\]\)")),
-        "tests_base"        : (str, _regex_(r"gl_TESTS_BASE\(\[(.*?)\]\)")),
-        "makefile_name"     : (str, _regex_(r"gl_MAKEFILE_NAME\(\[(.*?)\]\)")),
-        "macro_prefix"      : (str, _regex_(r"gl_MACRO_PREFIX\(\[(.*?)\]\)")),
-        "po_domain"         : (str, _regex_(r"gl_PO_DOMAIN\(\[(.*?)\]\)")),
-        "witness_c_macro"   : (str, _regex_(r"gl_WITNESS_C_MACRO\(\[(.*?)\]\)")),
-        "lib"               : (str, _regex_(r"gl_LIB\(\[(.*?)\]\)")),
-        "modules"           : (list, _regex_(r"gl_MODULES\(\[(.*?)\]\)")),
-        "avoid"             : (list, _regex_(r"gl_AVOID\(\[(.*?)\]\)")),
-        "licenses"          : (str, _regex_(r"gl_LGPL\(\[(.*?)\]\)")),
+    _GNULIB_CACHE = {
+        "local"             : (str, _compile(r"gl_LOCAL_DIR\(\[(.*?)\]\)")),
+        "libtool"           : (bool, _compile(r"gl_LIBTOOL\(\[(.*?)\]\)")),
+        "conddeps"          : (bool, _compile(r"gl_CONDITIONAL_DEPENDENCIES\(\[(.*?)\]\)")),
+        "vc_files"          : (bool, _compile(r"gl_VC_FILES\(\[(.*?)\]\)")),
+        "tests"             : (bool, _compile(r"gl_WITH_TESTS\(\[(.*?)\]\)")),
+        "obsolete"          : (bool, _compile(r"gl_WITH_OBSOLETE\(\[(.*?)\]\)")),
+        "cxx_tests"         : (bool, _compile(r"gl_WITH_CXX_TESTS\(\[(.*?)\]\)")),
+        "longrunning_tests" : (bool, _compile(r"gl_WITH_LONGRUNNING_TESTS\(\[(.*?)\]\)")),
+        "privileged_tests"  : (bool, _compile(r"gl_WITH_PRIVILEGED_TESTS\(\[(.*?)\]\)")),
+        "unportable_tests"  : (bool, _compile(r"gl_WITH_UNPORTABLE_TESTS\(\[(.*?)\]\)")),
+        "all_tests"         : (bool, _compile(r"gl_WITH_ALL_TESTS\(\[(.*?)\]\)")),
+        "source_base"       : (str, _compile(r"gl_SOURCE_BASE\(\[(.*?)\]\)")),
+        "m4_base"           : (str, _compile(r"gl_M4_BASE\(\[(.*?)\]\)")),
+        "po_base"           : (str, _compile(r"gl_PO_BASE\(\[(.*?)\]\)")),
+        "doc_base"          : (str, _compile(r"gl_DOC_BASE\(\[(.*?)\]\)")),
+        "tests_base"        : (str, _compile(r"gl_TESTS_BASE\(\[(.*?)\]\)")),
+        "makefile_name"     : (str, _compile(r"gl_MAKEFILE_NAME\(\[(.*?)\]\)")),
+        "macro_prefix"      : (str, _compile(r"gl_MACRO_PREFIX\(\[(.*?)\]\)")),
+        "po_domain"         : (str, _compile(r"gl_PO_DOMAIN\(\[(.*?)\]\)")),
+        "witness_c_macro"   : (str, _compile(r"gl_WITNESS_C_MACRO\(\[(.*?)\]\)")),
+        "lib"               : (str, _compile(r"gl_LIB\(\[(.*?)\]\)")),
+        "modules"           : (list, _compile(r"gl_MODULES\(\[(.*?)\]\)")),
+        "avoid"             : (list, _compile(r"gl_AVOID\(\[(.*?)\]\)")),
+        "licenses"          : (str, _compile(r"gl_LGPL\(\[(.*?)\]\)")),
     }
 
 
     def __init__(self, configure=None, **kwargs):
         super().__init__(**kwargs)
         if configure is None:
-            configure = _os_.path.join(self.root, "configure.ac")
-            if not _os_.path.exists(configure):
-                configure = _os_.path.join(self.root, "configure.in")
-        if not _os_.path.isabs(configure):
-            configure = _os_.path.join(self.root, configure)
-        kwargs = {"configure": _os_.path.normpath(configure), "explicit": tuple(kwargs.keys())}
+            configure = _os.path.join(self.root, "configure.ac")
+            if not _os.path.exists(configure):
+                configure = _os.path.join(self.root, "configure.in")
+        if not _os.path.isabs(configure):
+            configure = _os.path.join(self.root, configure)
+        kwargs = {"configure": _os.path.normpath(configure), "explicit": tuple(kwargs.keys())}
         calls = (self.__configure_ac, self.__gnulib_cache, self.__gnulib_comp)
         for call in calls:
             try:
@@ -610,22 +611,22 @@
 
 
     def __configure_ac(self, configure, explicit, **kwargs):
-        with _codecs_.open(configure, "rb", "UTF-8") as stream:
-            data = Cache._COMMENTS_.sub("", stream.read())
-        for (key, pattern) in Cache._AUTOCONF_.items():
+        with _codecs.open(configure, "rb", "UTF-8") as stream:
+            data = Cache._COMMENTS.sub("", stream.read())
+        for (key, pattern) in Cache._AUTOCONF.items():
             match = pattern.findall(data)
             if match and key not in explicit:
                 self[key] = match[-1]
 
     def __gnulib_cache(self, explicit, **kwargs):
         m4_base = self.m4_base
-        path = _os_.path.join(self.root, self.m4_base, "gnulib-cache.m4")
-        path = _os_.path.normpath(path)
-        if not _os_.path.exists(path):
+        path = _os.path.join(self.root, self.m4_base, "gnulib-cache.m4")
+        path = _os.path.normpath(path)
+        if not _os.path.exists(path):
             raise FileNotFoundError(path)
-        with _codecs_.open(path, "rb", "UTF-8") as stream:
-            data = Cache._COMMENTS_.sub("", stream.read())
-        for (key, (typeid, pattern)) in Cache._GNULIB_CACHE_.items():
+        with _codecs.open(path, "rb", "UTF-8") as stream:
+            data = Cache._COMMENTS.sub("", stream.read())
+        for (key, (typeid, pattern)) in Cache._GNULIB_CACHE.items():
             match = pattern.findall(data)
             if match and key not in explicit:
                 if key == "licenses":
@@ -642,17 +643,17 @@
                 else:
                     self[key] = [_.strip() for _ in match[-1].split("\n") if _.strip()]
         if m4_base != self.m4_base:
-            raise _M4BaseMismatchError_(path, m4_base, self.m4_base)
+            raise _M4BaseMismatchError(path, m4_base, self.m4_base)
 
     def __gnulib_comp(self, explicit, **kwargs):
         macro_prefix = self.macro_prefix
-        path = _os_.path.join(self.root, self.m4_base, "gnulib-comp.m4")
-        path = _os_.path.normpath(path)
-        if not _os_.path.exists(path):
+        path = _os.path.join(self.root, self.m4_base, "gnulib-comp.m4")
+        path = _os.path.normpath(path)
+        if not _os.path.exists(path):
             raise FileNotFoundError(path)
-        with _codecs_.open(path, "rb", "UTF-8") as stream:
-            data = Cache._COMMENTS_.sub("", stream.read())
-        pattern = _regex_(r"AC_DEFUN\(\[{0}_FILE_LIST\], \[(.*?)\]\)".format(macro_prefix))
+        with _codecs.open(path, "rb", "UTF-8") as stream:
+            data = Cache._COMMENTS.sub("", stream.read())
+        pattern = _compile(r"AC_DEFUN\(\[{0}_FILE_LIST\], \[(.*?)\]\)".format(macro_prefix))
         match = pattern.findall(data)
         if match and "files" not in explicit:
             self.files = [_.strip() for _ in match[-1].split("\n") if _.strip()]
--- a/pygnulib/generator.py	Sun Oct 22 22:43:46 2017 +0300
+++ b/pygnulib/generator.py	Sun Oct 22 23:13:50 2017 +0300
@@ -7,15 +7,15 @@
 import os as _os_
 
 
-from .error import type_assert as _type_assert_
-from .config import Base as _BaseConfig_
-from .module import Base as _BaseModule_
+from .error import type_assert as _type_assert
+from .config import Base as _BaseConfig
+from .module import Base as _BaseModule
 
 
 
 class Generator:
     """gnulib file content generator"""
-    _TEMPLATE_ = (
+    _TEMPLATE = (
         "## DO NOT EDIT! GENERATED AUTOMATICALLY!",
         "#",
         "# This file is free software; you can redistribute it and/or modify",
@@ -48,14 +48,14 @@
         return "\n".join([_ for _ in self])
 
     def __iter__(self):
-        for line in Generator._TEMPLATE_:
+        for line in Generator._TEMPLATE:
             yield line
 
 
 
 class POMakefile(Generator):
     """PO Makefile parameterization"""
-    _TEMPLATE_ = (
+    _TEMPLATE = (
         "# These options get passed to xgettext.",
         "XGETTEXT_OPTIONS = \\",
         "  --keyword=_ --flag=_:1:pass-c-format \\",
@@ -97,7 +97,7 @@
         "USE_MSGCTXT = no"
     )
     def __init__(self, config):
-        _type_assert_("config", config, _BaseConfig_)
+        _type_assert("config", config, _BaseConfig)
         super().__init__()
         self.__config = config
 
@@ -131,7 +131,7 @@
         yield "# These two variables depend on the location of this directory."
         yield "subdir = {}".format(self.po_domain)
         yield "top_subdir = {}".format("/".join(".." for _ in self.po_base.split(_os_.path.sep)))
-        for line in POMakefile._TEMPLATE_:
+        for line in POMakefile._TEMPLATE:
             yield line
 
 
@@ -139,7 +139,7 @@
 class POTFILES(Generator):
     """file list to be passed to xgettext"""
     def __init__(self, config, files):
-        _type_assert_("config", config, _BaseConfig_)
+        _type_assert("config", config, _BaseConfig)
         super().__init__()
         self.__config = config
         self.__files = tuple(files)
@@ -177,11 +177,11 @@
         no_libtool: disable libtool (regardless of configuration)
         no_gettext: disable AM_GNU_GETTEXT invocations if True
         """
-        _type_assert_("config", config, _BaseConfig_)
-        _type_assert_("module", module, _BaseModule_)
-        _type_assert_("toplevel", toplevel, bool)
-        _type_assert_("no_libtool", no_libtool, bool)
-        _type_assert_("no_gettext", no_gettext, bool)
+        _type_assert("config", config, _BaseConfig)
+        _type_assert("module", module, _BaseModule)
+        _type_assert("toplevel", toplevel, bool)
+        _type_assert("no_libtool", no_libtool, bool)
+        _type_assert("no_gettext", no_gettext, bool)
         super().__init__()
         self.__config = config
         self.__module = module
@@ -264,10 +264,10 @@
         config: gnulib configuration
         macro_prefix: macro prefix; if None, consider configuration
         """
-        _type_assert_("config", config, _BaseConfig_)
+        _type_assert("config", config, _BaseConfig)
         if macro_prefix is None:
             macro_prefix = config.macro_prefix
-        _type_assert_("macro_prefix", macro_prefix, str)
+        _type_assert("macro_prefix", macro_prefix, str)
         self.__macro_prefix = macro_prefix
 
 
@@ -287,7 +287,7 @@
 
 class InitMacroHeader(InitMacro):
     """the first few statements of the gl_INIT macro"""
-    _TEMPLATE_ = (
+    _TEMPLATE = (
         # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
         # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead
         # of LIBOBJS. The purpose is to allow several gnulib instantiations under
@@ -329,14 +329,14 @@
 
     def __iter__(self):
         macro_prefix = self.macro_prefix
-        for line in InitMacroHeader._TEMPLATE_:
+        for line in InitMacroHeader._TEMPLATE:
             yield line.format(macro_prefix=macro_prefix)
 
 
 
 class InitMacroFooter(InitMacro):
     """the last few statements of the gl_INIT macro"""
-    _TEMPLATE_ = (
+    _TEMPLATE = (
         "  m4_ifval({macro_prefix}_LIBSOURCES_LIST, [",
         "    m4_syscmd([test ! -d ]m4_defn([{macro_prefix}_LIBSOURCES_DIR])[ ||",
         "      for gl_file in ]{macro_prefix}_LIBSOURCES_LIST[ ; do",
@@ -384,14 +384,14 @@
         # arguments. The check is performed only when autoconf is run from the
         # directory where the configure.ac resides; if it is run from a different
         # directory, the check is skipped.
-        for line in InitMacroFooter._TEMPLATE_:
+        for line in InitMacroFooter._TEMPLATE:
             yield line.format(macro_prefix=self.macro_prefix)
 
 
 
 class InitMacroDone(InitMacro):
     """few statements AFTER the gl_INIT macro"""
-    _TEMPLATE_ = (
+    _TEMPLATE = (
         "",
         "# Like AC_LIBOBJ, except that the module name goes",
         "# into {macro_prefix}_LIBOBJS instead of into LIBOBJS.",
@@ -426,7 +426,7 @@
         super().__init__(config=config, macro_prefix=macro_prefix)
         if source_base is None:
             source_base = config.source_base
-        _type_assert_("source_base", source_base, str)
+        _type_assert("source_base", source_base, str)
         self.__source_base = source_base
 
 
@@ -437,5 +437,5 @@
 
 
     def __iter__(self):
-        for line in InitMacroDone._TEMPLATE_:
+        for line in InitMacroDone._TEMPLATE:
             yield line.format(source_base=self.__source_base, macro_prefix=self.macro_prefix)
--- a/pygnulib/module.py	Sun Oct 22 22:43:46 2017 +0300
+++ b/pygnulib/module.py	Sun Oct 22 23:13:50 2017 +0300
@@ -4,24 +4,25 @@
 
 
 
-import codecs as _codecs_
-import hashlib as _hashlib_
-import collections as _collections_
-import os as _os_
-import re as _re_
+import codecs as _codecs
+import hashlib as _hashlib
+import collections as _collections
+import os as _os
+import re as _re
 
 
-from .error import type_assert as _type_assert_
-from .error import UnknownModuleError as _UnknownModuleError_
+from .error import type_assert as _type_assert
+from .error import UnknownModuleError as _UnknownModuleError
 
 
 
-_ITERABLES_ = (list, tuple, set, frozenset)
+_ITERABLES = (list, tuple, set, frozenset)
+
 
 
 class Base:
     """gnulib generic module"""
-    _TABLE_ = {
+    _TABLE = {
         "description"            : (0x00, str, "Description"),
         "comment"                : (0x01, str, "Comment"),
         "status"                 : (0x02, frozenset, "Status"),
@@ -37,22 +38,22 @@
         "licenses"               : (0x0C, frozenset, "License"),
         "maintainers"            : (0x0D, frozenset, "Maintainer"),
     }
-    _PATTERN_DEPENDENCIES_ = _re_.compile("^(\\S+)(?:\\s+(.+))*$")
+    _DEPENDENCIES = _re.compile("^(\\S+)(?:\\s+(.+))*$")
 
 
     def __init__(self, name, **kwargs):
-        _type_assert_("name", name, str)
+        _type_assert("name", name, str)
         if "licenses" in kwargs:
             licenses = set()
             for license in kwargs.get("licenses", frozenset()):
-                _type_assert_("license", license, str)
+                _type_assert("license", license, str)
                 licenses.add(license)
             kwargs["licenses"] = licenses
         if "maintainers" not in kwargs:
             kwargs["maintainers"] = ("all",)
-        self.__table = _collections_.OrderedDict()
+        self.__table = _collections.OrderedDict()
         self.__table["name"] = name
-        for (key, (_, typeid, _)) in Base._TABLE_.items():
+        for (key, (_, typeid, _)) in Base._TABLE.items():
             self.__table[key] = typeid(kwargs.get(key, typeid()))
 
 
@@ -63,7 +64,7 @@
 
     @name.setter
     def name(self, value):
-        _type_assert_("name", value, str)
+        _type_assert("name", value, str)
         self.__table["name"] = value
 
 
@@ -74,7 +75,7 @@
 
     @description.setter
     def description(self, value):
-        _type_assert_("description", value, str)
+        _type_assert("description", value, str)
         self.__table["description"] = value
 
 
@@ -85,7 +86,7 @@
 
     @comment.setter
     def comment(self, value):
-        _type_assert_("comment", value, str)
+        _type_assert("comment", value, str)
         self.__table["comment"] = value
 
 
@@ -96,10 +97,10 @@
 
     @status.setter
     def status(self, value):
-        _type_assert_("status", value, _ITERABLES_)
+        _type_assert("status", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("status", item, str)
+            _type_assert("status", item, str)
             result.add(item)
         self.__table["status"] = frozenset(result)
 
@@ -137,7 +138,7 @@
 
     @notice.setter
     def notice(self, value):
-        _type_assert_("notice", value, str)
+        _type_assert("notice", value, str)
         self.__table["notice"] = value
 
 
@@ -150,7 +151,7 @@
 
     @applicability.setter
     def applicability(self, value):
-        _type_assert_("applicability", value, str)
+        _type_assert("applicability", value, str)
         if value not in ("all", "main", "tests"):
             raise ValueError("applicability: \"main\", \"tests\" or \"all\"")
         self.__table["applicability"] = value
@@ -164,10 +165,10 @@
 
     @files.setter
     def files(self, value):
-        _type_assert_("files", value, _ITERABLES_)
+        _type_assert("files", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("file", item, str)
+            _type_assert("file", item, str)
             result.add(item)
         self.__table["files"] = frozenset(result)
 
@@ -176,15 +177,15 @@
     def dependencies(self):
         """dependencies iterator (name, condition)"""
         for entry in self.__table["dependencies"]:
-            yield Base._PATTERN_DEPENDENCIES_.findall(entry)[0]
+            yield Base._DEPENDENCIES.findall(entry)[0]
 
     @dependencies.setter
     def dependencies(self, value):
-        _type_assert_("files", value, _ITERABLES_)
+        _type_assert("files", value, _ITERABLES)
         result = set()
         for (name, condition) in value:
-            _type_assert_("name", name, str)
-            _type_assert_("condition", condition, str)
+            _type_assert("name", name, str)
+            _type_assert("condition", condition, str)
             result.add((name, condition))
         self.__table["dependencies"] = frozenset(result)
 
@@ -196,7 +197,7 @@
 
     @early_autoconf_snippet.setter
     def early_autoconf_snippet(self, value):
-        _type_assert_("early_autoconf_snippet", value, str)
+        _type_assert("early_autoconf_snippet", value, str)
         self.__table["early_autoconf_snippet"] = value
 
 
@@ -207,7 +208,7 @@
 
     @autoconf_snippet.setter
     def autoconf_snippet(self, value):
-        _type_assert_("autoconf_snippet", value, str)
+        _type_assert("autoconf_snippet", value, str)
         self.__table["autoconf_snippet"] = value
 
 
@@ -218,7 +219,7 @@
 
     @automake_snippet.setter
     def automake_snippet(self, value):
-        _type_assert_("automake_snippet", value, str)
+        _type_assert("automake_snippet", value, str)
         self.__table["automake_snippet"] = value
 
 
@@ -232,7 +233,7 @@
 
     @include_directive.setter
     def include_directive(self, value):
-        _type_assert_("include_directive", value, str)
+        _type_assert("include_directive", value, str)
         self.__table["include_directive"] = value
 
 
@@ -243,7 +244,7 @@
 
     @link_directive.setter
     def link_directive(self, value):
-        _type_assert_("link_directive", value, str)
+        _type_assert("link_directive", value, str)
         self.__table["link_directive"] = value
 
 
@@ -254,10 +255,10 @@
 
     @licenses.setter
     def licenses(self, value):
-        _type_assert_("licenses", value, _ITERABLES_)
+        _type_assert("licenses", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("license", item, str)
+            _type_assert("license", item, str)
             result.add(value)
         self.__table["licenses"] = frozenset(result)
 
@@ -269,10 +270,10 @@
 
     @maintainers.setter
     def maintainers(self, value):
-        _type_assert_("maintainers", value, _ITERABLES_)
+        _type_assert("maintainers", value, _ITERABLES)
         result = set()
         for item in value:
-            _type_assert_("maintainer", item, str)
+            _type_assert("maintainer", item, str)
             result.add(item)
         self.__table["maintainers"] = frozenset(result)
 
@@ -282,7 +283,7 @@
         module = self.name
         if len(module) != len(module.encode()):
             module = (module + "\n").encode("UTF-8")
-            module = _hashlib_.md5(module).hexdigest()
+            module = _hashlib.md5(module).hexdigest()
         return "{}_gnulib_enabled_{}".format(macro_prefix, module)
 
 
@@ -291,7 +292,7 @@
         module = self.name
         if len(module) != len(module.encode()):
             module = (module + "\n").encode("UTF-8")
-            module = _hashlib_.md5(module).hexdigest()
+            module = _hashlib.md5(module).hexdigest()
         return "func_{}_gnulib_m4code_{}".format(macro_prefix, module)
 
 
@@ -300,7 +301,7 @@
         module = self.name
         if len(module) != len(module.encode()):
             module = (module + "\n").encode("UTF-8")
-            module = _hashlib_.md5(module).hexdigest()
+            module = _hashlib.md5(module).hexdigest()
         return "{}_GNULIB_ENABLED_{}".format(macro_prefix, module)
 
 
@@ -316,9 +317,9 @@
 
     def __str__(self):
         result = ""
-        for (key, (_, typeid, field)) in sorted(Base._TABLE_.items(), key=lambda k: k[1][0]):
+        for (key, (_, typeid, field)) in sorted(Base._TABLE.items(), key=lambda k: k[1][0]):
             field += ":\n"
-            if typeid in _ITERABLES_:
+            if typeid in _ITERABLES:
                 value = "\n".join(self.__table[key])
             else:
                 value = self.__table[key]
@@ -330,17 +331,17 @@
 
 
     def __getitem__(self, key):
-        if key not in Base._TABLE_:
+        if key not in Base._TABLE:
             key = key.replace("-", "_")
-            if key not in Base._TABLE_:
+            if key not in Base._TABLE:
                 raise KeyError(repr(key))
         return getattr(self, key)
 
 
     def __setitem__(self, key, value):
-        if key not in Base._TABLE_:
+        if key not in Base._TABLE:
             key = key.replace("-", "_")
-            if key not in Base._TABLE_:
+            if key not in Base._TABLE:
                 raise KeyError(repr(key))
         return setattr(self, key, value)
 
@@ -386,25 +387,25 @@
 
 class File(Base):
     """gnulib module text file"""
-    _TABLE_ = {}
-    for (_key_, (_, _typeid_, _value_)) in Base._TABLE_.items():
-        _TABLE_[_value_] = (_typeid_, _key_)
-    _FIELDS_ = [field for (_, _, field) in Base._TABLE_.values()]
-    _PATTERN_ = _re_.compile("({}):".format("|".join(_FIELDS_)))
+    _TABLE = {}
+    for (_key, (_, _typeid, _value)) in Base._TABLE.items():
+        _TABLE[_value] = (_typeid, _key)
+    _FIELDS = [field for (_, _, field) in Base._TABLE.values()]
+    _PATTERN = _re.compile("({}):".format("|".join(_FIELDS)))
 
 
     def __init__(self, path, mode="r", name=None, **kwargs):
         table = {}
         if name is None:
-            name = _os_.path.basename(path)
+            name = _os.path.basename(path)
         if mode not in ("r", "w", "rw"):
             raise ValueError("illegal mode: {}".format(mode))
         if mode == "r":
-            with _codecs_.open(path, "rb", "UTF-8") as stream:
-                match = File._PATTERN_.split(stream.read())[1:]
+            with _codecs.open(path, "rb", "UTF-8") as stream:
+                match = File._PATTERN.split(stream.read())[1:]
             for (group, value) in zip(match[::2], match[1::2]):
-                (typeid, key) = File._TABLE_[group]
-                if typeid in _ITERABLES_:
+                (typeid, key) = File._TABLE[group]
+                if typeid in _ITERABLES:
                     lines = []
                     for line in value.splitlines():
                         if not line.strip() or line.startswith("#"):
@@ -419,11 +420,11 @@
                 table["licenses"] = ["GPLv2, LGPLv3+"]
             self.__stream = None
         elif mode == "w":
-            self.__stream = _codecs_.open(path, "w+", "UTF-8")
+            self.__stream = _codecs.open(path, "w+", "UTF-8")
         elif mode == "rw":
             super().__init__(name)
             self.__init__(path, "r")
-            self.__stream = _codecs_.open(path, "w+", "UTF-8")
+            self.__stream = _codecs.open(path, "w+", "UTF-8")
         else:
             raise ValueError("illegal mode: {}".format(mode))
 
@@ -474,7 +475,7 @@
     for (key, value) in options.items():
         if key not in keywords:
             return KeyError(key)
-        _type_assert_("option", value, bool)
+        _type_assert("option", value, bool)
     modules = set(lookup(module) for module in modules)
 
     def _exclude_(module):
@@ -502,7 +503,7 @@
                         module = lookup("{0}-tests".format(demander.name))
                         if not _exclude_(module):
                             current.add((module, None, None))
-                    except _UnknownModuleError_:
+                    except _UnknownModuleError:
                         pass # ignore non-existent tests
                 for (dependency, condition) in demander.dependencies:
                     module = lookup(dependency)
@@ -532,12 +533,12 @@
 
 
 
-_DUMMY_REQUIRED_PATTERN_ = _re_.compile(r"^lib_SOURCES\s*\+\=\s*(.*?)$", _re_.S | _re_.M)
+_DUMMY_REQUIRED_PATTERN = _re.compile(r"^lib_SOURCES\s*\+\=\s*(.*?)$", _re.S | _re.M)
 def dummy_required(modules):
     """Determine whether dummy module is required."""
     for module in modules:
         snippet = module.automake_snippet
-        match = _DUMMY_REQUIRED_PATTERN_.findall(snippet)
+        match = _DUMMY_REQUIRED_PATTERN.findall(snippet)
         for files in match:
             files = (files.split("#", 1)[0].split(" "))
             files = (file.strip() for file in files if file.strip())
--- a/pygnulib/parser.py	Sun Oct 22 22:43:46 2017 +0300
+++ b/pygnulib/parser.py	Sun Oct 22 23:13:50 2017 +0300
@@ -4,12 +4,12 @@
 
 
 
-import argparse as _argparse_
-import os as _os_
+import argparse as _argparse
+import os as _os
 
-from .error import CommandLineError as _CommandLineError_
+from .error import CommandLineError as _CommandLineError
 
-from .config import LGPLv2_LICENSE as _LGPLv2_LICENSE_
+from .config import LGPLv2_LICENSE as _LGPLv2_LICENSE
 from .config import LGPLv3_LICENSE as _LGPLv3_LICENSE_
 from .config import GPLv2_LICENSE as _GPLv2_LICENSE_
 from .config import LGPL_LICENSE as _LGPL_LICENSE_
@@ -18,93 +18,93 @@
 
 class CommandLine:
     """gnulib-tool command line configuration"""
-    _LIST_ = (1 << 0)
-    _FIND_ = (1 << 1)
-    _IMPORT_ = (1 << 2)
-    _ADD_IMPORT_ = (1 << 3)
-    _REMOVE_IMPORT_ = (1 << 4)
-    _UPDATE_ = (1 << 5)
-    _TEST_DIRECTORY_ = (1 << 6)
-    _MEGA_TEST_DIRECTORY_ = (1 << 7)
-    _TEST_ = (1 << 8)
-    _MEGA_TEST_ = (1 << 9)
-    _COPY_FILE_ = (1 << 10)
-    _EXTRACT_DESCRIPTION_ = (1 << 11)
-    _EXTRACT_COMMENT_ = (1 << 12)
-    _EXTRACT_STATUS_ = (1 << 13)
-    _EXTRACT_NOTICE_ = (1 << 14)
-    _EXTRACT_APPLICABILITY_ = (1 << 15)
-    _EXTRACT_FILELIST_ = (1 << 16)
-    _EXTRACT_DEPENDENCIES_ = (1 << 17)
-    _EXTRACT_AUTOCONF_SNIPPET_ = (1 << 18)
-    _EXTRACT_AUTOMAKE_SNIPPET_ = (1 << 19)
-    _EXTRACT_INCLUDE_DIRECTIVE_ = (1 << 20)
-    _EXTRACT_LINK_DIRECTIVE_ = (1 << 21)
-    _EXTRACT_LICENSE_ = (1 << 22)
-    _EXTRACT_MAINTAINER_ = (1 << 23)
-    _EXTRACT_TESTS_MODULE_ = (1 << 24)
+    _LIST = (1 << 0)
+    _FIND = (1 << 1)
+    _IMPORT = (1 << 2)
+    _ADD_IMPORT = (1 << 3)
+    _REMOVE_IMPORT = (1 << 4)
+    _UPDATE = (1 << 5)
+    _TEST_DIRECTORY = (1 << 6)
+    _MEGA_TEST_DIRECTORY = (1 << 7)
+    _TEST = (1 << 8)
+    _MEGA_TEST = (1 << 9)
+    _COPY_FILE = (1 << 10)
+    _EXTRACT_DESCRIPTION = (1 << 11)
+    _EXTRACT_COMMENT = (1 << 12)
+    _EXTRACT_STATUS = (1 << 13)
+    _EXTRACT_NOTICE = (1 << 14)
+    _EXTRACT_APPLICABILITY = (1 << 15)
+    _EXTRACT_FILELIST = (1 << 16)
+    _EXTRACT_DEPENDENCIES = (1 << 17)
+    _EXTRACT_AUTOCONF_SNIPPET = (1 << 18)
+    _EXTRACT_AUTOMAKE_SNIPPET = (1 << 19)
+    _EXTRACT_INCLUDE_DIRECTIVE = (1 << 20)
+    _EXTRACT_LINK_DIRECTIVE = (1 << 21)
+    _EXTRACT_LICENSE = (1 << 22)
+    _EXTRACT_MAINTAINER = (1 << 23)
+    _EXTRACT_TESTS_MODULE = (1 << 24)
     _HELP_ = (1 << 25)
-    _ANY_IMPORT_ = _IMPORT_ | _ADD_IMPORT_ | _REMOVE_IMPORT_ | _UPDATE_
-    _ANY_TEST_ = _TEST_ | _MEGA_TEST_ | _TEST_DIRECTORY_ | _MEGA_TEST_DIRECTORY_
-    _ANY_EXTRACT = _EXTRACT_DESCRIPTION_ | _EXTRACT_COMMENT_ | _EXTRACT_STATUS_ | \
-                   _EXTRACT_NOTICE_ | _EXTRACT_APPLICABILITY_ | _EXTRACT_FILELIST_ | \
-                   _EXTRACT_DEPENDENCIES_ | _EXTRACT_AUTOCONF_SNIPPET_ | \
-                   _EXTRACT_AUTOMAKE_SNIPPET_ | _EXTRACT_INCLUDE_DIRECTIVE_ | \
-                   _EXTRACT_LINK_DIRECTIVE_ | _EXTRACT_LICENSE_ | _EXTRACT_MAINTAINER_ | \
-                   _EXTRACT_TESTS_MODULE_
-    _ALL_ = _LIST_ | _FIND_ | _ANY_IMPORT_ | _ANY_TEST_
-    _MODES_ = (
-        (_LIST_, "list", ""),
-        (_FIND_, "find", "filename"),
-        (_IMPORT_, "import", "[module1 ... moduleN]"),
-        (_ADD_IMPORT_, "add-import", "[module1 ... moduleN]"),
-        (_REMOVE_IMPORT_, "remove-import", "[module1 ... moduleN]"),
-        (_UPDATE_, "update", ""),
-        (_TEST_DIRECTORY_, "testdir", "--dir=directory [module1 ... moduleN]"),
-        (_MEGA_TEST_DIRECTORY_, "megatestdir", "--dir=directory [module1 ... moduleN]"),
-        (_TEST_, "test", "--dir=directory [module1 ... moduleN]"),
-        (_MEGA_TEST_, "megatest", "--dir=directory [module1 ... moduleN]"),
-        (_EXTRACT_DESCRIPTION_, "extract-description", "module"),
-        (_EXTRACT_COMMENT_, "extract-comment", "module"),
-        (_EXTRACT_STATUS_, "extract-status", "module"),
-        (_EXTRACT_NOTICE_, "extract-notice", "module"),
-        (_EXTRACT_APPLICABILITY_, "extract-applicability", "module"),
-        (_EXTRACT_FILELIST_, "extract-filelist", "module"),
-        (_EXTRACT_DEPENDENCIES_, "extract-dependencies", "module"),
-        (_EXTRACT_AUTOCONF_SNIPPET_, "extract-autoconf-snippet", "module"),
-        (_EXTRACT_AUTOMAKE_SNIPPET_, "extract-automake-snippet", "module"),
-        (_EXTRACT_INCLUDE_DIRECTIVE_, "extract-include-directive", "module"),
-        (_EXTRACT_LINK_DIRECTIVE_, "extract-link-directive", "module"),
-        (_EXTRACT_LICENSE_, "extract-license", "module"),
-        (_EXTRACT_MAINTAINER_, "extract-maintainer", "module"),
-        (_EXTRACT_TESTS_MODULE_, "extract-tests-module", "module"),
-        (_COPY_FILE_, "copy", "file [destination]"),
+    _ANY_IMPORT = _IMPORT | _ADD_IMPORT | _REMOVE_IMPORT | _UPDATE
+    _ANY_TEST = _TEST | _MEGA_TEST | _TEST_DIRECTORY | _MEGA_TEST_DIRECTORY
+    _ANY_EXTRACT = _EXTRACT_DESCRIPTION | _EXTRACT_COMMENT | _EXTRACT_STATUS | \
+                   _EXTRACT_NOTICE | _EXTRACT_APPLICABILITY | _EXTRACT_FILELIST | \
+                   _EXTRACT_DEPENDENCIES | _EXTRACT_AUTOCONF_SNIPPET | \
+                   _EXTRACT_AUTOMAKE_SNIPPET | _EXTRACT_INCLUDE_DIRECTIVE | \
+                   _EXTRACT_LINK_DIRECTIVE | _EXTRACT_LICENSE | _EXTRACT_MAINTAINER | \
+                   _EXTRACT_TESTS_MODULE
+    _ALL = _LIST | _FIND | _ANY_IMPORT | _ANY_TEST
+    _MODES = (
+        (_LIST, "list", ""),
+        (_FIND, "find", "filename"),
+        (_IMPORT, "import", "[module1 ... moduleN]"),
+        (_ADD_IMPORT, "add-import", "[module1 ... moduleN]"),
+        (_REMOVE_IMPORT, "remove-import", "[module1 ... moduleN]"),
+        (_UPDATE, "update", ""),
+        (_TEST_DIRECTORY, "testdir", "--dir=directory [module1 ... moduleN]"),
+        (_MEGA_TEST_DIRECTORY, "megatestdir", "--dir=directory [module1 ... moduleN]"),
+        (_TEST, "test", "--dir=directory [module1 ... moduleN]"),
+        (_MEGA_TEST, "megatest", "--dir=directory [module1 ... moduleN]"),
+        (_EXTRACT_DESCRIPTION, "extract-description", "module"),
+        (_EXTRACT_COMMENT, "extract-comment", "module"),
+        (_EXTRACT_STATUS, "extract-status", "module"),
+        (_EXTRACT_NOTICE, "extract-notice", "module"),
+        (_EXTRACT_APPLICABILITY, "extract-applicability", "module"),
+        (_EXTRACT_FILELIST, "extract-filelist", "module"),
+        (_EXTRACT_DEPENDENCIES, "extract-dependencies", "module"),
+        (_EXTRACT_AUTOCONF_SNIPPET, "extract-autoconf-snippet", "module"),
+        (_EXTRACT_AUTOMAKE_SNIPPET, "extract-automake-snippet", "module"),
+        (_EXTRACT_INCLUDE_DIRECTIVE, "extract-include-directive", "module"),
+        (_EXTRACT_LINK_DIRECTIVE, "extract-link-directive", "module"),
+        (_EXTRACT_LICENSE, "extract-license", "module"),
+        (_EXTRACT_MAINTAINER, "extract-maintainer", "module"),
+        (_EXTRACT_TESTS_MODULE, "extract-tests-module", "module"),
+        (_COPY_FILE, "copy", "file [destination]"),
         (_HELP_, "help", ""),
     )
-    _LINK_SYMBOLIC_ = (1 << 0)
-    _LINK_HARD_ = (1 << 1)
-    _LINK_LOCAL_ = (1 << 2)
-    _LINK_NOTICE_ = (1 << 3)
+    _LINK_SYMBOLIC = (1 << 0)
+    _LINK_HARD = (1 << 1)
+    _LINK_LOCAL = (1 << 2)
+    _LINK_NOTICE = (1 << 3)
 
 
-    class _Option_(_argparse_.Action):
+    class _Option(_argparse.Action):
         def __init__(self, *args, **kwargs):
             self.__flags = kwargs.pop("flags")
             self.__options = kwargs["option_strings"]
-            super().__init__(default=_argparse_.SUPPRESS, *args, **kwargs)
+            super().__init__(default=_argparse.SUPPRESS, *args, **kwargs)
 
 
         def __call__(self, parser, namespace, value, option=None):
             if hasattr(namespace, "mode"):
                 mode = getattr(namespace, "mode")
                 if mode and not (self.__flags & mode) and (mode != CommandLine._HELP_):
-                    mode = "--" + {k:v for (k, v, _) in CommandLine._MODES_}[mode]
+                    mode = "--" + {k:v for (k, v, _) in CommandLine._MODES}[mode]
                     fmt = "argument {0}: not allowed with {1}"
                     parser.error(fmt.format(mode, option))
             setattr(namespace, self.dest, value)
 
 
-    class _ConstOption_(_Option_):
+    class _ConstOption(_Option):
         def __init__(self, *args, **kwargs):
             self.__const = kwargs.pop("const")
             super().__init__(nargs=0, *args, **kwargs)
@@ -116,32 +116,32 @@
             super().__call__(*args)
 
 
-    class _TrueOption_(_ConstOption_):
+    class _TrueOption(_ConstOption):
         def __init__(self, *args, **kwargs):
             super().__init__(const=True, *args, **kwargs)
 
 
-    class _FalseOption_(_ConstOption_):
+    class _FalseOption(_ConstOption):
         def __init__(self, *args, **kwargs):
             super().__init__(const=False, *args, **kwargs)
 
 
-    class _ModeOption_(_Option_):
+    class _ModeOption(_Option):
         def __init__(self, *args, **kwargs):
             mode = kwargs["const"]
             kwargs["dest"] = "mode"
             kwargs["nargs"] = 0
-            if mode & CommandLine._UPDATE_:
+            if mode & CommandLine._UPDATE:
                 kwargs["nargs"] = 0
-            elif mode & CommandLine._ANY_IMPORT_ \
-            or mode & CommandLine._ANY_TEST_ \
+            elif mode & CommandLine._ANY_IMPORT \
+            or mode & CommandLine._ANY_TEST \
             or mode & CommandLine._ANY_EXTRACT:
                 kwargs["nargs"] = "*"
                 kwargs["metavar"] = "module0 ... moduleN"
-            elif mode & CommandLine._FIND_:
+            elif mode & CommandLine._FIND:
                 kwargs.pop("nargs")
                 kwargs["metavar"] = "FILE"
-            elif mode & CommandLine._COPY_FILE_:
+            elif mode & CommandLine._COPY_FILE:
                 kwargs["nargs"] = "+"
                 kwargs["metavar"] = "SRC [DST]"
             super().__init__(*args, **kwargs)
@@ -154,7 +154,7 @@
             new_option = option
             new_mode = None
             old_mode = getattr(namespace, self.dest)
-            for (mode, name, _) in CommandLine._MODES_:
+            for (mode, name, _) in CommandLine._MODES:
                 option = ("--" + name)
                 if mode == old_mode:
                     old_option = option
@@ -168,13 +168,13 @@
                 if old_mode != 0:
                     fmt = "argument {0}: not allowed with {1}"
                     parser.error(fmt.format(new_option, old_option))
-            if new_mode != CommandLine._UPDATE_:
+            if new_mode != CommandLine._UPDATE:
                 setattr(namespace, "modules", set(value))
             value = new_mode
             super().__call__(parser, namespace, value, option)
 
 
-    class _AvoidOption_(_Option_):
+    class _AvoidOption(_Option):
         def __call__(self, parser, namespace, value, option=None):
             if not hasattr(namespace, self.dest):
                 setattr(namespace, self.dest, list())
@@ -182,7 +182,7 @@
             super().__call__(parser, namespace, value, option)
 
 
-    class _VerbosityOption_(_Option_):
+    class _VerbosityOption(_Option):
         def __init__(self, *args, **kwargs):
             super().__init__(nargs=0, *args, **kwargs)
 
@@ -196,12 +196,12 @@
             super().__call__(parser, namespace, value, option)
 
 
-    class _LGPLOption_(_Option_):
+    class _LGPLOption(_Option):
         def __call__(self, parser, namespace, value, option=None):
             if value not in {"2", "3", "yes", "3orGPLv2"}:
                 parser.error("argument --lgpl: 2, 3, yes or 3orGPLv2")
             value = {
-                "2": _LGPLv2_LICENSE_,
+                "2": _LGPLv2_LICENSE,
                 "3": _LGPLv3_LICENSE_,
                 "yes": _LGPL_LICENSE_,
                 "3orGPLv2": (_GPLv2_LICENSE_ | _LGPLv3_LICENSE_),
@@ -209,7 +209,7 @@
             super().__call__(parser, namespace, value, option)
 
 
-    class _CopyModeOption_(_Option_):
+    class _CopyModeOption(_Option):
         def __init__(self, *args, **kwargs):
             super().__init__(nargs=0, *args, **kwargs)
 
@@ -226,7 +226,7 @@
             super().__call__(parser, namespace, value, option)
 
 
-    class _CopyrightsCopyModeOption_(_CopyModeOption_):
+    class _CopyrightsCopyModeOption(_CopyModeOption):
         def __call__(self, parser, namespace, value, option=None):
             if not hasattr(namespace, self.dest):
                 setattr(namespace, "copyrights", False)
@@ -256,22 +256,22 @@
                     "help": (
                         "print the available module names",
                     ),
-                    "action": _ModeOption_,
-                    "const": _LIST_,
+                    "action": _ModeOption,
+                    "const": _LIST,
                 }),
                 (["-f", "--find"], {
                     "help": (
                         "find the modules which contain the specified file",
                     ),
-                    "action": _ModeOption_,
-                    "const": _FIND_,
+                    "action": _ModeOption,
+                    "const": _FIND,
                 }),
                 (["-i", "--import"], {
                     "help": (
                         "import the given modules into the current package",
                     ),
-                    "action": _ModeOption_,
-                    "const": _IMPORT_,
+                    "action": _ModeOption,
+                    "const": _IMPORT,
                 }),
                 (["-a", "--add-import"], {
                     "help": (
@@ -280,139 +280,139 @@
                         "if no modules are specified, update the current",
                         "package from the current gnulib",
                     ),
-                    "action": _ModeOption_,
-                    "const": _ADD_IMPORT_,
+                    "action": _ModeOption,
+                    "const": _ADD_IMPORT,
                 }),
                 (["-r", "--remove-import"], {
                     "help": (
                         "reduce the list of imports from gnulib into the",
                         "current package, by removing the given modules",
                     ),
-                    "action": _ModeOption_,
-                    "const": _REMOVE_IMPORT_,
+                    "action": _ModeOption,
+                    "const": _REMOVE_IMPORT,
                 }),
                 (["-u", "--update"], {
                     "help": (
                         "update the current package, restore files omitted",
                         "from version control",
                     ),
-                    "action": _ModeOption_,
-                    "const": _UPDATE_,
+                    "action": _ModeOption,
+                    "const": _UPDATE,
                 }),
 
                 (["--extract-description"], {
                     "help": (
                         "extract the description",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_DESCRIPTION_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_DESCRIPTION,
                 }),
                 (["--extract-comment"], {
                     "help": (
                         "extract the comment",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_COMMENT_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_COMMENT,
                 }),
                 (["--extract-status"], {
                     "help": (
                         "extract the status (obsolete etc.)",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_STATUS_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_STATUS,
                 }),
                 (["--extract-notice"], {
                     "help": (
                         "extract the notice or banner",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_NOTICE_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_NOTICE,
                 }),
                 (["--extract-applicability"], {
                     "help": (
                         "extract the applicability",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_APPLICABILITY_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_APPLICABILITY,
                 }),
                 (["--extract-filelist"], {
                     "help": (
                         "extract the list of files",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_FILELIST_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_FILELIST,
                 }),
                 (["--extract-dependencies"], {
                     "help": (
                         "extract the dependencies",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_DEPENDENCIES_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_DEPENDENCIES,
                 }),
                 (["--extract-autoconf-snippet"], {
                     "help": (
                         "extract the snippet for configure.ac",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_AUTOCONF_SNIPPET_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_AUTOCONF_SNIPPET,
                 }),
                 (["--extract-automake-snippet"], {
                     "help": (
                         "extract the snippet for library makefile",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_AUTOMAKE_SNIPPET_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_AUTOMAKE_SNIPPET,
                 }),
                 (["--extract-include-directive"], {
                     "help": (
                         "extract the #include directive",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_INCLUDE_DIRECTIVE_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_INCLUDE_DIRECTIVE,
                 }),
                 (["--extract-link-directive"], {
                     "help": (
                         "extract the linker directive",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_LINK_DIRECTIVE_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_LINK_DIRECTIVE,
                 }),
                 (["--extract-license"], {
                     "help": (
                         "report the license terms of the source files",
                         "under lib/",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_LICENSE_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_LICENSE,
                 }),
                 (["--extract-maintainer", "--extract-maintainers"], {
                     "help": (
                         "report the maintainer(s) inside gnulib",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_MAINTAINER_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_MAINTAINER,
                 }),
                 (["--extract-tests-module"], {
                     "help": (
                         "report the unit test module, if it exists",
                     ),
-                    "action": _ModeOption_,
-                    "const": _EXTRACT_TESTS_MODULE_,
+                    "action": _ModeOption,
+                    "const": _EXTRACT_TESTS_MODULE,
                 }),
 
                 (["--copy-file"], {
                     "help": (
                         "copy a file that is not part of any module",
                     ),
-                    "action": _ModeOption_,
-                    "const": _COPY_FILE_,
+                    "action": _ModeOption,
+                    "const": _COPY_FILE,
                 }),
 
                 (["--help"], {
                     "help": (
                         "show this help text",
                     ),
-                    "action": _ModeOption_,
+                    "action": _ModeOption,
                     "const": _HELP_,
                 }),
             ),
@@ -421,7 +421,7 @@
 
         (
             "General options",
-            _ALL_,
+            _ALL,
             (
                 (["--dir"], {
                     "help": (
@@ -429,7 +429,7 @@
                         "this specifies where your configure.ac",
                         "can be found; defaults to current directory",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "dest": "root",
                     "metavar": "DIRECTORY",
                 }),
@@ -438,7 +438,7 @@
                         "pecify a local override directory where to look",
                         "up files before looking in gnulib's directory",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "dest": "local",
                     "metavar": "DIRECTORY",
                 }),
@@ -446,14 +446,14 @@
                     "help": (
                         "increase verbosity; may be repeated",
                     ),
-                    "action": _VerbosityOption_,
+                    "action": _VerbosityOption,
                     "dest": "verbosity",
                 }),
                 (["-q", "--quiet"], {
                     "help": (
                         "decrease verbosity; may be repeated",
                     ),
-                    "action": _VerbosityOption_,
+                    "action": _VerbosityOption,
                     "dest": "verbosity",
                 }),
             ),
@@ -462,13 +462,13 @@
 
         (
             "Options for --import, --add/remove-import, --update",
-            _ANY_IMPORT_,
+            _ANY_IMPORT,
             (
                 (["--dry-run"], {
                     "help": (
                         "only print what would have been done",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "dry_run",
                 }),
             ),
@@ -477,13 +477,13 @@
 
         (
             "Options for --import, --add/remove-import",
-            (_IMPORT_ | _ADD_IMPORT_ | _REMOVE_IMPORT_),
+            (_IMPORT | _ADD_IMPORT | _REMOVE_IMPORT),
             (
                 (["--with-tests"], {
                     "help": (
                         "include unit tests for the included modules",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "tests",
                 }),
                 (["--single-configure"], {
@@ -491,7 +491,7 @@
                         "generate a single configure file, not a separate",
                         "configure file for the tests directory",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "single_configure",
                 }),
             ),
@@ -500,13 +500,13 @@
 
         (
             "Options for --create-[mega]testdir, --[mega]test",
-            _ANY_TEST_,
+            _ANY_TEST,
             (
                 (["--without-tests"], {
                     "help": (
                         "don't include unit tests for the included modules",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "tests",
                 }),
             ),
@@ -517,7 +517,7 @@
             "Options for --import, --add/remove-import,"
             "\n"
             "            --create-[mega]testdir, --[mega]test",
-            (_ANY_IMPORT_ & ~_UPDATE_) | _ANY_TEST_,
+            (_ANY_IMPORT & ~_UPDATE) | _ANY_TEST,
             (
                 (["--with-obsolete"], {
                     "help": (
@@ -525,7 +525,7 @@
                         "dependencies; by default, dependencies to obsolete",
                         "modules are ignored",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "obsolete",
                 }),
 
@@ -533,14 +533,14 @@
                     "help": (
                         "include even unit tests for C++ interoperability",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "cxx_tests",
                 }),
                 (["--without-c++-tests"], {
                     "help": (
                         "exclude unit tests for C++ interoperability",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "cxx_tests",
                 }),
 
@@ -548,14 +548,14 @@
                     "help": (
                         "include even unit tests that are long-runners",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "longrunning_tests",
                 }),
                 (["--without-longrunning-tests"], {
                     "help": (
                         "exclude unit tests that are long-runners",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "longrunning_tests",
                 }),
 
@@ -563,14 +563,14 @@
                     "help": (
                         "include even unit tests that require root privileges",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "privileged_tests",
                 }),
                 (["--without-privileged-tests"], {
                     "help": (
                         "exclude unit tests that require root privileges",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "privileged_tests",
                 }),
 
@@ -578,14 +578,14 @@
                     "help": (
                         "include even unit tests that fail on some platforms",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "unportable_tests",
                 }),
                 (["--without-unportable-tests"], {
                     "help": (
                         "exclude unit tests that fail on some platforms",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "unportable_tests",
                 }),
 
@@ -593,7 +593,7 @@
                     "help": (
                         "include all kinds of problematic unit tests",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "all_tests",
                 }),
                 (["--avoid"], {
@@ -602,7 +602,7 @@
                         "have code that provides equivalent functionality;",
                         "this option can be repeated",
                     ),
-                    "action": _AvoidOption_,
+                    "action": _AvoidOption,
                     "nargs": 1,
                     "metavar": "MODULE",
                 }),
@@ -611,28 +611,28 @@
                         "support conditional dependencies (may save configure",
                         "time and object code)",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "conddeps",
                 }),
                 (["--no-conditional-dependencies"], {
                     "help": (
                         "don't use conditional dependencies",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "conddeps",
                 }),
                 (["--libtool"], {
                     "help": (
                         "use libtool rules",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "libtool",
                 }),
                 (["--no-libtool"], {
                     "help": (
                         "don't use libtool rules",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "libtool",
                 }),
             ),
@@ -641,13 +641,13 @@
 
         (
             "Options for --import, --add/remove-import",
-            (_ANY_IMPORT_ & ~_UPDATE_),
+            (_ANY_IMPORT & ~_UPDATE),
             (
                 (["--lib"], {
                     "help": (
                         "specify the library name; defaults to 'libgnu'",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "LIBRARY",
                 }),
                 (["--source-base"], {
@@ -655,7 +655,7 @@
                         "directory relative to --dir where source code is",
                         "placed (default \"lib\")",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "DIRECTORY",
                 }),
                 (["--m4-base"], {
@@ -663,7 +663,7 @@
                         "directory relative to --dir where *.m4 macros are",
                         "placed (default \"m4\")",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "DIRECTORY",
                 }),
                 (["--po-base"], {
@@ -671,7 +671,7 @@
                         "directory relative to --dir where *.po files are",
                         "placed (default \"po\")",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "DIRECTORY",
                 }),
                 (["--doc-base"], {
@@ -679,7 +679,7 @@
                         "directory relative to --dir where doc files are",
                         "placed (default \"doc\")",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "DIRECTORY",
                 }),
                 (["--tests-base"], {
@@ -687,7 +687,7 @@
                         "directory relative to --dir where unit tests are",
                         "placed (default \"tests\")",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "DIRECTORY",
                 }),
                 (["--aux-dir"], {
@@ -695,7 +695,7 @@
                         "directory relative to --dir where auxiliary build",
                         "tools are placed (default comes from configure.ac);",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "dest": "auxdir",
                     "metavar": "DIRECTORY",
                 }),
@@ -706,7 +706,7 @@
                         "the version number of the LGPL can be specified;",
                         "the default is currently LGPLv3.",
                     ),
-                    "action": _LGPLOption_,
+                    "action": _LGPLOption,
                     "dest": "licenses",
                     "metavar": "[=2|=3orGPLv2|=3]",
                 }),
@@ -716,7 +716,7 @@
                         "source-base and tests-base directories",
                         "(default \"Makefile.am\")",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "NAME",
                 }),
                 (["--macro-prefix"], {
@@ -724,7 +724,7 @@
                         "specify the prefix of the macros 'gl_EARLY' and",
                         "'gl_INIT'; default is 'gl'",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "PREFIX",
                 }),
                 (["--po-domain"], {
@@ -732,7 +732,7 @@
                         "specify the prefix of the i18n domain; usually use",
                         "the package name; a suffix '-gnulib' is appended",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "NAME",
                 }),
                 (["--witness-c-macro"], {
@@ -740,7 +740,7 @@
                         "specify the C macro that is defined when the",
                         "sources in this directory are compiled or used",
                     ),
-                    "action": _Option_,
+                    "action": _Option,
                     "metavar": "NAME",
                 }),
                 (["--vc-files"], {
@@ -748,7 +748,7 @@
                         "update version control related files",
                         "(.gitignore and/or .cvsignore)",
                     ),
-                    "action": _TrueOption_,
+                    "action": _TrueOption,
                     "dest": "vc_files",
                 }),
                 (["--no-vc-files"], {
@@ -756,7 +756,7 @@
                         "don't update version control related files",
                         "(.gitignore and/or .cvsignore)",
                     ),
-                    "action": _FalseOption_,
+                    "action": _FalseOption,
                     "dest": "libtool",
                 }),
                 (["--no-changelog"], {
@@ -764,7 +764,7 @@
                         "don't update or create ChangeLog files;",
                         "this option is currently deprecated",
                     ),
-                    "action": _ConstOption_,
+                    "action": _ConstOption,
                     "const": None,
                 }),
             ),
@@ -775,13 +775,13 @@
             "Options for --import, --add/remove-import, --update"
             "\n"
             "            --create-[mega]testdir, --[mega]test",
-            _ANY_IMPORT_ | _ANY_TEST_,
+            _ANY_IMPORT | _ANY_TEST,
             (
                 (["-s", "--symlink"], {
                     "help": (
                         "make symbolic links instead of copying files",
                     ),
-                    "action": _CopyModeOption_,
+                    "action": _CopyModeOption,
                     "dest": "copymode",
                 }),
                 (["--local-symlink"], {
@@ -789,14 +789,14 @@
                         "make symbolic links instead of copying files, only",
                         "for files from the local override directory"
                     ),
-                    "action": _CopyModeOption_,
+                    "action": _CopyModeOption,
                     "dest": "local_copymode",
                 }),
                 (["-h", "--hardlink"], {
                     "help": (
                         "make hard links instead of copying files",
                     ),
-                    "action": _CopyModeOption_,
+                    "action": _CopyModeOption,
                     "dest": "copymode",
                 }),
                 (["--local-hardlink"], {
@@ -804,7 +804,7 @@
                         "make hard links instead of copying files, only",
                         "for files from the local override directory"
                     ),
-                    "action": _CopyModeOption_,
+                    "action": _CopyModeOption,
                     "dest": "local_copymode",
                 }),
             ),
@@ -813,14 +813,14 @@
 
         (
             "Options for --import, --add/remove-import, --update",
-            _ANY_IMPORT_,
+            _ANY_IMPORT,
             (
                 (["-S", "--more-symlink"], {
                     "help": (
                         "make symbolic links instead of copying files and",
                         "don't replace copyright notices",
                     ),
-                    "action": _CopyrightsCopyModeOption_,
+                    "action": _CopyrightsCopyModeOption,
                     "dest": "copymode",
                 }),
                 (["-H", "--more-hardlink"], {
@@ -828,7 +828,7 @@
                         "make symbolic links instead of copying files and",
                         "don't replace copyright notices",
                     ),
-                    "action": _CopyrightsCopyModeOption_,
+                    "action": _CopyrightsCopyModeOption,
                     "dest": "copymode",
                 }),
             ),
@@ -837,7 +837,7 @@
 
 
     def __error(self, message):
-        raise _CommandLineError_(self.__program, message)
+        raise _CommandLineError(self.__program, message)
 
 
     def __format_help(self):
@@ -871,7 +871,7 @@
 
 
     def __format_usage(self):
-        iterable = iter(CommandLine._MODES_)
+        iterable = iter(CommandLine._MODES)
         (_, cmd, args) = next(iterable)
         fmt = (" --{cmd}" + (" {args}" if args else ""))
         lines = ["usage: {program}" + fmt.format(cmd=cmd, args=args)]
@@ -889,14 +889,14 @@
 
 
     def __init__(self, program):
-        self.__parser = _argparse_.ArgumentParser(prog=program, add_help=False)
+        self.__parser = _argparse.ArgumentParser(prog=program, add_help=False)
         for (options, kwargs) in CommandLine._SECTIONS_[0][2]:
             flags = kwargs.get("const")
             self.__parser.add_argument(*options, **kwargs, flags=flags)
         for (_, flags, args) in CommandLine._SECTIONS_[1:]:
             for (options, kwargs) in args:
                 self.__parser.add_argument(*options, **kwargs, flags=flags)
-        self.__program = _os_.path.basename(program)
+        self.__program = _os.path.basename(program)
         self.__parser.error = self.__error
         self.__parser.format_help = self.__format_help
         self.__parser.format_usage = self.__format_usage
@@ -936,7 +936,7 @@
             fmt = "unrecognized arguments: {0}"
             arguments = " ".join(arguments)
             self.__parser.error(fmt.format(arguments))
-        mode = {k:v for (k, v, _) in CommandLine._MODES_}[mode]
+        mode = {k:v for (k, v, _) in CommandLine._MODES}[mode]
         if mode in {"import", "add-import", "remove-import"} and not namespace["modules"]:
             fmt = "--{0}: expected at least one argument"
             self.__parser.error(fmt.format(mode))
--- a/pygnulib/vfs.py	Sun Oct 22 22:43:46 2017 +0300
+++ b/pygnulib/vfs.py	Sun Oct 22 23:13:50 2017 +0300
@@ -4,29 +4,29 @@
 
 
 
-import codecs as _codecs_
-import os as _os_
-import shutil as _shutil_
-import tempfile as _tempfile_
-import subprocess as _sp_
+import codecs as _codecs
+import os as _os
+import shutil as _shutil
+import tempfile as _tempfile
+import subprocess as _sp
 
 
-from .error import type_assert as _type_assert_
-from .error import UnknownModuleError as _UnknownModuleError_
-from .module import Base as _BaseModule_
-from .module import File as _FileModule_
+from .error import type_assert as _type_assert
+from .error import UnknownModuleError as _UnknownModuleError
+from .module import Base as _BaseModule
+from .module import File as _FileModule
 
 
 
 class Base:
     """gnulib generic virtual file system"""
     def __init__(self, prefix, **table):
-        _type_assert_("prefix", prefix, str)
+        _type_assert("prefix", prefix, str)
         self.__table = {}
         for (key, value) in table.items():
-            _type_assert_(key, value, str)
-            self.__table[key] = _os_.path.normpath(value)
-        self.__prefix = _os_.path.abspath(prefix)
+            _type_assert(key, value, str)
+            self.__table[key] = _os.path.normpath(value)
+        self.__prefix = _os.path.abspath(prefix)
 
 
     def __repr__(self):
@@ -36,21 +36,21 @@
 
 
     def __contains__(self, name):
-        path = _os_.path.normpath(name)
-        if _os_.path.isabs(name):
+        path = _os.path.normpath(name)
+        if _os.path.isabs(name):
             raise ValueError("name must be a relative path")
-        path = _os_.path.join(self.__prefix, name)
-        return _os_.path.exists(path)
+        path = _os.path.join(self.__prefix, name)
+        return _os.path.exists(path)
 
 
     def __getitem__(self, name):
-        _type_assert_("name", name, str)
+        _type_assert("name", name, str)
         parts = []
         replaced = False
-        path = _os_.path.normpath(name)
-        if _os_.path.isabs(path):
+        path = _os.path.normpath(name)
+        if _os.path.isabs(path):
             raise ValueError("name cannot be an absolute path")
-        for part in path.split(_os_.path.sep):
+        for part in path.split(_os.path.sep):
             if part == "..":
                 parts += [part]
                 continue
@@ -58,8 +58,8 @@
                 part = self.__table[part]
                 replaced = True
             parts += [part]
-        path = _os_.path.sep.join([self.__prefix] + parts)
-        return _os_.path.normpath(path)
+        path = _os.path.sep.join([self.__prefix] + parts)
+        return _os.path.normpath(path)
 
 
     @property
@@ -71,17 +71,17 @@
     @property
     def full_prefix(self):
         """absolute path prefix"""
-        return _os_.path.abspath(self.__prefix)
+        return _os.path.abspath(self.__prefix)
 
 
 
 class Project(Base):
     """project virtual file system"""
     def __init__(self, name, **table):
-        path = _os_.path.realpath(name)
-        if not _os_.path.exists(path):
+        path = _os.path.realpath(name)
+        if not _os.path.exists(path):
             raise FileNotFoundError(path)
-        if not _os_.path.isdir(path):
+        if not _os.path.isdir(path):
             raise NotADirectoryError(path)
         super().__init__(name, **table)
         self.__patch = None
@@ -96,9 +96,9 @@
 
     @patch.setter
     def patch(self, path):
-        _type_assert_("path", path, str)
-        if not _os_.path.isabs(path):
-            if _shutil_.which(path) is None:
+        _type_assert("path", path, str)
+        if not _os.path.isabs(path):
+            if _shutil.which(path) is None:
                 raise FileNotFoundError("patch")
         self.__patch = path
 
@@ -107,23 +107,23 @@
         """Backup the given file."""
         backup = "{}~".format(name)
         try:
-            _os_.unlink(self[backup])
+            _os.unlink(self[backup])
         except FileNotFoundError:
             pass # ignore non-existent files
-        _shutil_.copy(self[name], self[backup])
+        _shutil.copy(self[name], self[backup])
 
 
     def copy(self, src, dst):
         """Copy file data."""
-        srcabs = _os_.path.isabs(self, src)
-        dstabs = _os_.path.isabs(self, dst)
+        srcabs = _os.path.isabs(self, src)
+        dstabs = _os.path.isabs(self, dst)
         if srcabs and dstabs:
             raise ValueError("absolute src and dst")
         limit = (16 * 1024)
-        src = src if srcabs else _os_.path.join(self.full_prefix, src)
-        dst = dst if dstabs else _os_.path.join(self.full_prefix, dst)
-        with _codecs_.open(src, "rb") as istream:
-            with _codecs_.open(dst, "wb") as ostream:
+        src = src if srcabs else _os.path.join(self.full_prefix, src)
+        dst = dst if dstabs else _os.path.join(self.full_prefix, dst)
+        with _codecs.open(src, "rb") as istream:
+            with _codecs.open(dst, "wb") as ostream:
                 while 1:
                     data = istream.read(limit)
                     if not data:
@@ -133,13 +133,13 @@
 
     def hardlink(self, src, dst):
         """Create a hard link to the file."""
-        srcabs = _os_.path.isabs(self, src)
-        dstabs = _os_.path.isabs(self, dst)
+        srcabs = _os.path.isabs(self, src)
+        dstabs = _os.path.isabs(self, dst)
         if srcabs and dstabs:
             raise ValueError("absolute src and dst")
-        src = src if srcabs else _os_.path.join(self.full_prefix, src)
-        dst = dst if dstabs else _os_.path.join(self.full_prefix, dst)
-        _os_.link(src, dst)
+        src = src if srcabs else _os.path.join(self.full_prefix, src)
+        dst = dst if dstabs else _os.path.join(self.full_prefix, dst)
+        _os.link(src, dst)
 
 
     def lookup(self, name, primary, secondary):
@@ -156,68 +156,68 @@
         The second element, dynamic, designates whether the file is temporary.
         It is up to the caller to unlink dynamic files.
         """
-        _type_assert_("primary", primary, Base)
-        _type_assert_("secondary", secondary, Base)
+        _type_assert("primary", primary, Base)
+        _type_assert("secondary", secondary, Base)
         if name in secondary:
             return (secondary[name], False)
         diff = "{}.diff".format(name)
         if diff not in secondary:
             return (primary[name], False)
-        tmp = _tempfile_.NamedTemporaryFile(mode="w+b", delete=False)
-        with _codecs_.open(primary[name], "rb") as stream:
-            _shutil_.copyfileobj(stream, tmp)
+        tmp = _tempfile.NamedTemporaryFile(mode="w+b", delete=False)
+        with _codecs.open(primary[name], "rb") as stream:
+            _shutil.copyfileobj(stream, tmp)
             tmp.close()
-        stdin = _codecs_.open(secondary[diff], "rb")
+        stdin = _codecs.open(secondary[diff], "rb")
         cmd = (self.__patch, "-s", tmp.name)
-        pipes = _sp_.Popen(cmd, stdin=stdin, stdout=_sp_.PIPE, stderr=_sp_.PIPE)
+        pipes = _sp.Popen(cmd, stdin=stdin, stdout=_sp.PIPE, stderr=_sp.PIPE)
         (stdout, stderr) = pipes.communicate()
         stdout = stdout.decode("UTF-8")
         stderr = stderr.decode("UTF-8")
         returncode = pipes.returncode
         if returncode != 0:
             cmd = "patch -s {} < {}".format(tmp.name, secondary[diff])
-            raise _sp_.CalledProcessError(returncode, cmd, stdout, stderr)
+            raise _sp.CalledProcessError(returncode, cmd, stdout, stderr)
         return (tmp.name, True)
 
 
     def mkdir(self, name):
         """Create a leaf directory and all intermediate ones recursively."""
-        _os_.makedirs(self[name], exist_ok=True)
+        _os.makedirs(self[name], exist_ok=True)
 
 
     def move(self, src, dst):
         """Move file data."""
-        srcabs = _os_.path.isabs(self, src)
-        dstabs = _os_.path.isabs(self, dst)
+        srcabs = _os.path.isabs(self, src)
+        dstabs = _os.path.isabs(self, dst)
         if srcabs and dstabs:
             raise ValueError("absolute src and dst")
-        src = src if srcabs else _os_.path.join(self.full_prefix, src)
-        dst = dst if dstabs else _os_.path.join(self.full_prefix, dst)
-        _os_.rename(src, dst)
+        src = src if srcabs else _os.path.join(self.full_prefix, src)
+        dst = dst if dstabs else _os.path.join(self.full_prefix, dst)
+        _os.rename(src, dst)
 
 
     def symlink(self, src, dst):
         """Create a symbolic link to the file."""
-        srcabs = _os_.path.isabs(self, src)
-        dstabs = _os_.path.isabs(self, dst)
+        srcabs = _os.path.isabs(self, src)
+        dstabs = _os.path.isabs(self, dst)
         if srcabs and dstabs:
             raise ValueError("absolute src and dst")
-        src = src if srcabs else _os_.path.join(self.full_prefix, src)
-        dst = dst if dstabs else _os_.path.join(self.full_prefix, dst)
-        _os_.symlink(src, dst)
+        src = src if srcabs else _os.path.join(self.full_prefix, src)
+        dst = dst if dstabs else _os.path.join(self.full_prefix, dst)
+        _os.symlink(src, dst)
 
 
     def unlink(self, name, backup=True):
         """Unlink a file, backing it up if necessary."""
         if backup:
             self.backup(name)
-        _os_.unlink(self[name])
+        _os.unlink(self[name])
 
 
 
 class GnulibGit(Base):
     """gnulib git repository"""
-    _EXCLUDE_ = {
+    _EXCLUDE = {
         "."                 : str.startswith,
         "~"                 : str.endswith,
         "-tests"            : str.endswith,
@@ -232,11 +232,11 @@
 
     def __init__(self, prefix, **table):
         super().__init__(prefix, **table)
-        if not _os_.path.exists(self.full_prefix):
+        if not _os.path.exists(self.full_prefix):
             raise FileNotFoundError(self.full_prefix)
-        if not _os_.path.isdir(self.full_prefix):
+        if not _os.path.isdir(self.full_prefix):
             raise NotADirectoryError(self.full_prefix)
-        if not _os_.path.isdir(_os_.path.join(self.full_prefix, ".git")):
+        if not _os.path.isdir(_os.path.join(self.full_prefix, ".git")):
             raise TypeError("{} is not a gnulib repository".format(prefix))
 
 
@@ -250,31 +250,31 @@
 
     def module(self, name, full=True):
         """obtain gnulib module by name"""
-        _type_assert_("name", name, str)
-        _type_assert_("full", full, bool)
-        if name in GnulibGit._EXCLUDE_:
+        _type_assert("name", name, str)
+        _type_assert("full", full, bool)
+        if name in GnulibGit._EXCLUDE:
             raise ValueError("illegal module name")
-        path = _os_.path.join(self["modules"], name)
+        path = _os.path.join(self["modules"], name)
         try:
-            return _FileModule_(path, name=name) if full else _BaseModule_(name)
+            return _FileModule(path, name=name) if full else _BaseModule(name)
         except FileNotFoundError:
-            raise _UnknownModuleError_(name)
+            raise _UnknownModuleError(name)
 
 
     def modules(self, full=True):
         """iterate over all available modules"""
         prefix = self["modules"]
-        for root, _, files in _os_.walk(prefix):
+        for root, _, files in _os.walk(prefix):
             names = []
             for name in files:
                 exclude = False
-                for (key, method) in GnulibGit._EXCLUDE_.items():
+                for (key, method) in GnulibGit._EXCLUDE.items():
                     if method(name, key):
                         exclude = True
                         break
                 if not exclude:
                     names += [name]
             for name in names:
-                path = _os_.path.join(root, name)
+                path = _os.path.join(root, name)
                 name = path[len(prefix) + 1:]
                 yield self.module(name, full)