Commits

Panagiotis Mavrogiorgos committed b861f5c

Add python templates.

Comments (0)

Files changed (10)

templates/pyinit2.py

+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+"""
+Package description
+"""
+
+from __future__ import division
+from __future__ import print_function
+
+# Version
+__major__ = 0  # for major interface/format changes
+__minor__ = 1  # for minor interface/format changes
+__release__ = 1  # for tweaks, bug-fixes, or development
+
+# package information
+__package_name__ = "foobar"
+__version__ = "%d.%d.%d" % (__major__, __minor__, __release__)
+__license__ = "BSD"
+__url__ = "http://bitbucket.org/pmav99/%s" % __package_name__
+__download_url__ = "http://bitbucket.org/pmav99/%s/downloads" % __package_name__
+__author__ = "Panagiotis Mavrogiorgos"
+__author_email__ = "gmail pmav99"
+

templates/pyinit3.py

+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+"""
+Package description
+"""
+
+# Version
+__major__ = 0  # for major interface/format changes
+__minor__ = 1  # for minor interface/format changes
+__release__ = 1  # for tweaks, bug-fixes, or development
+
+# package information
+__package_name__ = "foobar"
+__version__ = "%d.%d.%d" % (__major__, __minor__, __release__)
+__license__ = "BSD"
+__url__ = "http://bitbucket.org/pmav99/%s" % __package_name__
+__download_url__ = "http://bitbucket.org/pmav99/%s/downloads" % __package_name__
+__author__ = "Panagiotis Mavrogiorgos"
+__author_email__ = "gmail pmav99"
+

templates/pylog2.py

+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+import os.path as osp
+import logging
+
+logger = logging.getLogger(osp.relpath(__file__))

templates/pylog3.py

+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+import os.path as osp
+import logging
+
+logger = logging.getLogger(osp.relpath(__file__))

templates/pymain2.py

+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+import os.path as osp
+import logging
+import argparse
+
+logger = logging.getLogger(osp.relpath(__file__))
+
+LOGGING_LEVELS = {
+    'critical': logging.CRITICAL,
+    'error': logging.ERROR,
+    'warning': logging.WARNING,
+    'info': logging.INFO,
+    'debug': logging.DEBUG}
+
+
+def main():
+    import packagename as package
+
+    parser = argparse.ArgumentParser(
+        description=package.__doc__,
+        prog=package.__package_name__,
+        epilog="")
+
+    parser.add_argument('--version',
+        action='version',
+        version='%(prog)s ' + '%s' % package.__version__)
+
+    parser.add_argument("-l",
+        help="Logging level",
+        default="error",
+        dest="logging_level",
+        choices=("debug", "info", "warning", "error", "critical"))
+
+    parser.add_argument("-f",
+        help="Logging file name",
+        dest="logging_filename")
+
+    options = parser.parse_args()
+    logging_level = LOGGING_LEVELS[options.logging_level]
+    logging_filename = options.logging_filename
+
+    logging.basicConfig(
+        level=logging_level,
+        filename=logging_filename,
+        datefmt='%Y-%m-%d %H:%M:%S',
+        #format='%(asctime)s %(name)s %(levelname)s: %(message)s')
+        format='%(name)s %(levelname)s: %(message)s')
+
+    # Logging examples
+    #logger.debug("This is a debug message.")
+    #logger.info("This is an info message.")
+    #logger.warning("This is an warning message.")
+    #logger.error("This is an error message.")
+    #logger.critical("This is a critical message.")
+
+    # Call your program from here.
+
+if __name__ == "__main__":
+    main()

templates/pymain3.py

+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+import os.path as osp
+import logging
+import argparse
+
+logger = logging.getLogger(osp.relpath(__file__))
+
+LOGGING_LEVELS = {
+    'critical': logging.CRITICAL,
+    'error': logging.ERROR,
+    'warning': logging.WARNING,
+    'info': logging.INFO,
+    'debug': logging.DEBUG}
+
+
+def main():
+    import packagename as package
+
+    parser = argparse.ArgumentParser(
+        description=package.__doc__,
+        prog=package.__package_name__,
+        epilog="")
+
+    parser.add_argument('--version',
+        action='version',
+        version='%(prog)s ' + '%s' % package.__version__)
+
+    parser.add_argument("-l",
+        help="Logging level",
+        default="error",
+        dest="logging_level",
+        choices=("debug", "info", "warning", "error", "critical"))
+
+    parser.add_argument("-f",
+        help="Logging file name",
+        dest="logging_filename")
+
+    options = parser.parse_args()
+    logging_level = LOGGING_LEVELS[options.logging_level]
+    logging_filename = options.logging_filename
+
+    logging.basicConfig(
+        level=logging_level,
+        filename=logging_filename,
+        datefmt='%Y-%m-%d %H:%M:%S',
+        #format='%(asctime)s %(name)s %(levelname)s: %(message)s')
+        format='%(name)s %(levelname)s: %(message)s')
+
+    # Logging examples
+    #logger.debug("This is a debug message.")
+    #logger.info("This is an info message.")
+    #logger.warning("This is an warning message.")
+    #logger.error("This is an error message.")
+    #logger.critical("This is a critical message.")
+
+    # Call your program from here.
+
+if __name__ == "__main__":
+    main()

templates/pyskel2.py

+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import

templates/pyskel3.py

+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99

templates/pytest2.py

+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+import unittest
+
+
+class MyTestCase(unittest.TestCase):
+    def setUp(self):
+        pass
+
+    def test_dummy(self):
+        pass
+
+
+if __name__ == "__main__":
+    unittest.main()

templates/pytest3.py

+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# author: Panagiotis Mavrogiorgos
+# email : gmail, pmav99
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+import unittest
+
+
+class MyTestCase(unittest.TestCase):
+    def setUp(self):
+        pass
+
+    def test_dummy(self):
+        pass
+
+
+if __name__ == "__main__":
+    unittest.main()