[libvirt] [test-API] Improve the comments telling what the scripts does for utils/*.py

Osier Yang jyang at redhat.com
Tue Apr 17 14:07:59 UTC 2012


It's a habit to comment on the top of program to tell what the program
does, and actually it's what GNU suggests:

<quote>
  <one line to give the program's name and a brief idea of what it does.>
  Copyright (C) <year>  <name of author>
</quote>
---
 utils/XMLParser.py    |    4 ++--
 utils/check.py        |    7 ++-----
 utils/env_parser.py   |    6 ++----
 utils/format.py       |    6 ++----
 utils/log.py          |    6 ++----
 utils/xmlbuilder.py   |    6 ++----
 utils/xmlgenerator.py |    6 ++----
 7 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/utils/XMLParser.py b/utils/XMLParser.py
index b254023..4d7fc72 100644
--- a/utils/XMLParser.py
+++ b/utils/XMLParser.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# XMLParser.py: Parse XML document, the result is a python dict.
+
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -17,8 +19,6 @@
 #
 # Filename: XMLParser.py
 # Summary: parse and xml document into a python dictionary
-# Description: The module is a tool to parses
-# and xml document into a python dictionary
 
 import os
 from xml.dom import minidom
diff --git a/utils/check.py b/utils/check.py
index 1db49e7..7f35418 100644
--- a/utils/check.py
+++ b/utils/check.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# check.py: Check methods for cases.
+#
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -14,11 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Filename: check.py
-# Summary: basic check operation needed by test
-# Description: The module is a tool to help conduct basic
-#              check operation on specified host
 
 import os
 import re
diff --git a/utils/env_parser.py b/utils/env_parser.py
index 6e49e50..e756a38 100644
--- a/utils/env_parser.py
+++ b/utils/env_parser.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# env_parser.py: Parser for environment config (env.cfg).
+#
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -14,10 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Filename: env_parser.py
-# Summary: parse the env configuration file
-# Description: The module is a tool to parse the env configuration file
 
 import ConfigParser
 import os
diff --git a/utils/format.py b/utils/format.py
index b72c987..2a35664 100644
--- a/utils/format.py
+++ b/utils/format.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# format.py: Print logging message in specific format.
+#
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -14,10 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Filename: format.py
-# Summary: generate specified kind of format string
-# Description: The module is a tool to generate specified kind of format string
 
 import os
 from string import Template
diff --git a/utils/log.py b/utils/log.py
index 3ca8729..4111fd9 100644
--- a/utils/log.py
+++ b/utils/log.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# log.py: Classes for logging.
+#
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -14,10 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Filename: log.py
-# Summary: log file operation
-# Description: The module is a tool to provide basic log file operation
 
 import time
 import os
diff --git a/utils/xmlbuilder.py b/utils/xmlbuilder.py
index a8a9871..d2ce6bb 100644
--- a/utils/xmlbuilder.py
+++ b/utils/xmlbuilder.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# xmlbuilder.py: Class for building XML for libvirt objects.
+#
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -14,10 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Filename: xmlbuilder.py
-# Summary: operation for building domain xml
-# Description: The module is to provide operation for building domain xml
 
 __DEBUG__ = False
 
diff --git a/utils/xmlgenerator.py b/utils/xmlgenerator.py
index 7f5839b..ee019b7 100644
--- a/utils/xmlgenerator.py
+++ b/utils/xmlgenerator.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 #
+# xmlgenerator.py: Generate XML for libvirt objects.
+#
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
 # libvirt-test-API is free software; you can redistribute it and/or
@@ -14,10 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Filename: xmlgenerator.py
-# Summary: generate domain xml
-# Description: The module is a tool to generate domain xml
 
 import os
 import sys
-- 
1.7.7.3




More information about the libvir-list mailing list