[hawkmoth] [PATCH] parser: rename hawkmoth module

  • From: Bruno Santos <brunomanuelsantos@xxxxxxxxxxxxxxxxxx>
  • To: hawkmoth@xxxxxxxxxxxxx
  • Date: Fri, 1 Feb 2019 23:33:31 +0100

Having a module with the same name as the package itself can be
confusing and no longer makes sense. Some functionality has been split
into a few other modules and Hawkmoth (the project) is no longer
represented by this single module.

The new name should better reflect this module's function within the
project: parsing source files.
---
 hawkmoth/__init__.py                | 5 ++---
 hawkmoth/{hawkmoth.py => parser.py} | 0
 test/test_hawkmoth.py               | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)
 rename hawkmoth/{hawkmoth.py => parser.py} (100%)

diff --git a/hawkmoth/__init__.py b/hawkmoth/__init__.py
index 99ae6f5..79062f6 100644
--- a/hawkmoth/__init__.py
+++ b/hawkmoth/__init__.py
@@ -21,8 +21,7 @@
 from sphinx.util.nodes import nested_parse_with_titles
 from sphinx.util.docutils import switch_source_input
 
-# The parser bits
-from hawkmoth import hawkmoth
+from hawkmoth.parser import parse
 
 with open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
                        'VERSION')) as version_file:
@@ -48,7 +47,7 @@ def __parse(self, viewlist, filename):
         compat = self.options.get('compat', env.config.cautodoc_compat)
         clang = self.options.get('clang', env.config.cautodoc_clang)
 
-        comments = hawkmoth.parse(filename, compat=compat, clang=clang)
+        comments = parse(filename, compat=compat, clang=clang)
 
         for (comment, meta) in comments:
             lineoffset = meta['line'] - 1
diff --git a/hawkmoth/hawkmoth.py b/hawkmoth/parser.py
similarity index 100%
rename from hawkmoth/hawkmoth.py
rename to hawkmoth/parser.py
diff --git a/test/test_hawkmoth.py b/test/test_hawkmoth.py
index 75eebbe..b6c7aa9 100755
--- a/test/test_hawkmoth.py
+++ b/test/test_hawkmoth.py
@@ -6,10 +6,10 @@
 import unittest
 
 import testenv
-from hawkmoth import hawkmoth
+from hawkmoth.parser import parse_to_string
 
 def _get_output(input_filename, **options):
-    return hawkmoth.parse_to_string(input_filename, False, **options)
+    return parse_to_string(input_filename, False, **options)
 
 def _get_expected(input_filename, **options):
     return testenv.read_file(input_filename, ext='stdout')
-- 
2.20.1


Other related posts: