Commits

Wolfgang Scherer  committed 45ddc05

adhoc.py: protable octal number specification (v2.5 does not like 0o666, v3.x does not like 0666).

  • Participants
  • Parent commits 6ef6b40

Comments (0)

Files changed (3)

 ^doc/adhoc-logo\.html$
 ^activity-graph\.[^/.]*$
 ^doc/adhoc-logo-v2-...\.svg$
+^doc/activity-graph
 
     @classmethod
     def import_(cls, mod_name=None, file_=None, mtime=None, # |:clm:||:api_fi:|
-                zipped=True, flat=None, source64=None):
+                zipped=True, flat=None, source64=None, mode=int("666" ,8)):
         # @:adhoc_run_time_section:@ off
         """Import adhoc'ed module."""
         # @:adhoc_run_time_section:@ on
 
     @classmethod
     def module_setup(cls, module=None, file_=None, mtime=None, # |:clm:||:api_fi:|
-                     source=None, mode=0666):
+                     source=None, mode=int("666", 8)):
         # @:adhoc_run_time_section:@ off
         '''Setup module for `AdHoc`.
         \\|:todo:| various modes are possible:

File check_006_octal.py

+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2012, Wolfgang Scherer, <Wolfgang.Scherer at gmx.de>
+#
+# This file is part of AdHoc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>,
+# or write to Wolfgang Scherer, <Wolfgang.Scherer at gmx.de>
+"""\
+check_006_octal.py - ::fillme::
+
+======  ====================
+usage:  check_006_octal.py [OPTIONS] ::fillme::
+or      import check_006_octal
+======  ====================
+
+Options
+=======
+
+  -q, --quiet           suppress warnings
+  -v, --verbose         verbose test output
+  -d, --debug=NUM       show debug information
+  -h, --help            display this help message
+
+  --template list       show available templates.
+  --template=NAME       extract named template to standard
+                        output. Default NAME is `-`.
+  --extract=DIR         extract adhoc files to directory DIR (default: `.`)
+  --explode=DIR         explode script with adhoc in directory DIR
+                        (default `__adhoc__`)
+  --implode             implode script with adhoc
+
+  -t, --test            run doc tests
+
+Module Members
+==============
+"""
+
+# --------------------------------------------------
+# |||:sec:||| COMPATIBILITY
+# --------------------------------------------------
+
+import sys
+# (progn (forward-line 1) (snip-insert-mode "py.b.printf" t) (insert "\n"))
+# adapted from http://www.daniweb.com/software-development/python/code/217214
+try:
+    printf = eval("print") # python 3.0 case
+except SyntaxError:
+    printf_dict = dict()
+    try:
+        exec("from __future__ import print_function\nprintf=print", printf_dict)
+        printf = printf_dict["printf"] # 2.6 case
+    except SyntaxError:
+        def printf(*args, **kwd): # 2.4, 2.5, define our own Print function
+            fout = kwd.get("file", sys.stdout)
+            w = fout.write
+            if args:
+                w(str(args[0]))
+            sep = kwd.get("sep", " ")
+            for a in args[1:]:
+                w(sep)
+                w(str(a))
+            w(kwd.get("end", "\n"))
+    del printf_dict
+
+# (progn (forward-line 1) (snip-insert-mode "py.b.sformat" t) (insert "\n"))
+try:
+    ('{0}').format(0)
+    def sformat (fmtspec, *args, **kwargs):
+        return fmtspec.format(*args, **kwargs)
+except AttributeError:
+    try:
+        import stringformat
+        def sformat (fmtspec, *args, **kwargs):
+            return stringformat.FormattableString(fmtspec).format(
+                *args, **kwargs)
+    except ImportError:
+        printf('error: stringformat missing. Try `easy_install stringformat`.', file=sys.stderr)
+
+# (progn (forward-line 1) (snip-insert-mode "py.f.isstring" t) (insert "\n"))
+# hide from 2to3
+exec('''
+def isstring(obj):
+    return isinstance(obj, basestring)
+''')
+try:
+    isstring("")
+except NameError:
+    def isstring(obj):
+        return isinstance(obj, str) or isinstance(obj, bytes)
+
+# (progn (forward-line 1) (snip-insert-mode "py.b.dict_items" t) (insert "\n"))
+try:
+    getattr(dict(), 'iteritems')
+    ditems  = lambda d: getattr(d, 'iteritems')()
+    dkeys   = lambda d: getattr(d, 'iterkeys')()
+    dvalues = lambda d: getattr(d, 'itervalues')()
+except AttributeError:
+    ditems  = lambda d: getattr(d, 'items')()
+    dkeys   = lambda d: getattr(d, 'keys')()
+    dvalues = lambda d: getattr(d, 'values')()
+
+import os
+import re
+
+# --------------------------------------------------
+# |||:sec:||| CONFIGURATION
+# --------------------------------------------------
+
+__all__ = []
+
+dbg_comm = ((('dbg_comm' in globals()) and (globals()['dbg_comm'])) or ('# '))
+dbg_twid = ((('dbg_twid' in globals()) and (globals()['dbg_twid'])) or (9))
+dbg_fwid = ((('dbg_fwid' in globals()) and (globals()['dbg_fwid'])) or (17))
+
+# (progn (forward-line 1) (snip-insert-mode "py.b.canonize.module" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.dbg.setup" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.strings" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.strclean" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.issequence" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.logging" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.ordereddict" t) (insert "\n"))
+
+# (progn (forward-line 1) (snip-insert-mode "py.main.pyramid.activate" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.main.wsgi.get.app" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.main.project.libdir" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.main.sql.alchemy" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.main.sql.ws" t) (insert "\n"))
+
+# @:adhoc_run_time:@
+#import adhoc                                               # @:adhoc:@
+
+# (progn (forward-line 1) (snip-insert-mode "py.b.posix" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.os.system.sh" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.prog.path" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.b.line.loop" t) (insert "\n"))
+
+# --------------------------------------------------
+# |||:sec:||| CLASSES
+# --------------------------------------------------
+
+# (progn (forward-line -1) (insert "\n") (snip-insert-mode "py.s.class" t) (backward-symbol-tag 2 "fillme" "::"))
+
+# --------------------------------------------------
+# |||:sec:||| FUNCTIONS
+# --------------------------------------------------
+
+# (progn (forward-line -1) (insert "\n") (snip-insert-mode "py.s.func" t) (backward-symbol-tag 2 "fillme" "::"))
+
+# --------------------------------------------------
+# |||:sec:||| UTILITIES
+# --------------------------------------------------
+
+# (progn (forward-line 1) (snip-insert-mode "py.c.placeholder.template" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.c.key.hash.ordered.dict" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.c.progress" t) (insert "\n"))
+
+# (progn (forward-line 1) (snip-insert-mode "py.f.hl" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.single.quote" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.remove.match" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.printenv" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.uname-s" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.printe" t) (insert "\n"))
+if 'printe' not in globals():
+    def printe(*args, **kwargs):                               # ||:fnc:||
+        kwargs['file'] = kwargs.get('file', sys.stderr)
+        printf(*args, **kwargs)
+
+# (progn (forward-line 1) (snip-insert-mode "py.f.dbg.squeeze" t) (insert "\n"))
+# (progn (forward-line 1) (snip-insert-mode "py.f.dbg.indent" t) (insert "\n"))
+
+def run(parameters, pass_opts):                            # ||:fnc:||
+    """Application runner, when called as __main__."""
+
+    # (progn (forward-line 1) (snip-insert-mode "py.bf.sql.ws" t) (insert "\n"))
+    # (progn (forward-line 1) (snip-insert-mode "py.bf.file.arg.loop" t) (insert "\n"))
+
+    octal = int("666", 8)
+
+    printe(sformat(
+        "{0}{3:^{1}} {4:<{2}s}: ]{5!s}[",
+        dbg_comm, dbg_twid, dbg_fwid, ':DBG:', 'int("666", 8)', octal))
+    printe(sformat(
+        "{0}{3:^{1}} {4:<{2}s}: ]{5:o}[",
+        dbg_comm, dbg_twid, dbg_fwid, ':DBG:', 'format {:o}', octal))
+
+    # |:here:|
+    pass
+
+# --------------------------------------------------
+# |||:sec:||| MAIN
+# --------------------------------------------------
+
+_quiet = False
+_verbose = False
+_debug = False
+
+# (progn (forward-line 1) (snip-insert-mode "py.f.setdefaultencoding" t) (insert "\n"))
+file_encoding_is_clean = False
+def setdefaultencoding(encoding=None, quiet=False):
+    if file_encoding_is_clean:
+        return
+    if encoding is None:
+        encoding='utf-8'
+    try:
+        isinstance('', basestring)
+        if not hasattr(sys, '_setdefaultencoding'):
+            if not quiet:
+                printf('''\
+Add this to /etc/python2.x/sitecustomize.py,
+or put it in local sitecustomize.py and adjust PYTHONPATH=".:${PYTHONPATH}"::
+
+    try:
+        import sys
+        setattr(sys, '_setdefaultencoding', getattr(sys, 'setdefaultencoding'))
+    except AttributeError:
+        pass
+
+Running with reload(sys) hack ...
+''', file=sys.stderr)
+            reload(sys)
+            setattr(sys, '_setdefaultencoding',
+                    getattr(sys, 'setdefaultencoding'))
+        sys._setdefaultencoding(encoding)
+    except NameError:
+        # python3 already has utf-8 default encoding ;-)
+        pass
+
+def main(argv):                                            # ||:fnc:||
+    global _quiet, _debug, _verbose
+    global RtAdHoc, AdHoc
+
+    _parameters = None
+    _pass_opts = []
+    try:
+        import argparse
+    except ImportError:
+        printe('error: argparse missing. Try `easy_install argparse`.')
+        sys.exit(1)
+
+    parser = argparse.ArgumentParser(add_help=False)
+    # parser.add_argument('--sum', dest='accumulate', action='store_const',
+    #                    const=sum, default=max,
+    #                    help='sum the integers (default: find the max)')
+    # |:opt:| add options
+    parser.add_argument(
+        '-q', '--quiet', action='store_const', const=-2,
+        dest='debug', default=0, help='suppress warnings')
+    parser.add_argument(
+        '-v', '--verbose', action='store_const', const=-1,
+        dest='debug', default=0, help='verbose test output')
+    parser.add_argument(
+        '-d', '--debug', nargs='?', action='store', type=int, metavar='NUM',
+        default = 0, const = 1,
+        help='show debug information')
+    parser.add_argument(
+        '-t', '--test', action='store_true',
+        help='run doc tests')
+    class AdHocAction(argparse.Action):
+        def __call__(self, parser, namespace, values, option_string=None):
+            list(map(lambda opt: setattr(namespace, opt, False),
+                     ('implode', 'explode', 'extract', 'template')))
+            setattr(namespace, option_string[2:], True)
+            setattr(namespace, 'adhoc_arg', values)
+    parser.add_argument(
+        '--implode', nargs=0, action=AdHocAction, default=False,
+        help='implode script with adhoc')
+    parser.add_argument(
+        '--explode', nargs='?', action=AdHocAction, type=str, metavar='DIR',
+        default=False, const='__adhoc__',
+        help='explode script with adhoc in directory DIR'
+        ' (default: `__adhoc__`)')
+    parser.add_argument(
+        '--extract', nargs='?', action=AdHocAction, type=str, metavar='DIR',
+        default=False, const = '.',
+        help='extract files to directory DIR (default: `.`)')
+    parser.add_argument(
+        '--template', nargs='?', action=AdHocAction, type=str, metavar='NAME',
+        default=False, const = '-',
+        help='extract named template to standard output. default NAME is ``-``')
+    parser.add_argument(
+        '-h', '--help', action='store_true',
+        help="display this help message")
+    parser.add_argument(
+        '--ap-help', action='store_true',
+        help="internal help message")
+    parser.add_argument(
+        'args', nargs='*', metavar='arg',
+        #'args', nargs='+', metavar='arg',
+        #type=argparse.FileType('r'), default=sys.stdin,
+        help='a series of arguments')
+    #_parameters = parser.parse_args()
+    (_parameters, _pass_opts) = parser.parse_known_args(argv[1:])
+    # generate argparse help
+    if _parameters.ap_help:
+        parser.print_help()
+        return 0
+    # standard help
+    if _parameters.help:
+        sys.stdout.write(__doc__)
+        return 0
+
+    _debug = _parameters.debug
+    if _debug > 0:
+        _verbose = True
+        _quiet = False
+    elif _debug < 0:
+        _verbose = (_debug == -1)
+        _quiet = not(_verbose)
+        _debug = 0
+    _parameters.debug = _debug
+    _parameters.verbose = _verbose
+    _parameters.quiet = _quiet
+
+    if _debug:
+        cmd_line = argv
+        sys.stderr.write(sformat(
+                "{0}{3:^{1}} {4:<{2}s}: ]{5!s}[\n",
+                ((('dbg_comm' in globals()) and (globals()['dbg_comm'])) or ('# ')),
+                ((('dbg_twid' in globals()) and (globals()['dbg_twid'])) or (9)),
+                ((('dbg_fwid' in globals()) and (globals()['dbg_fwid'])) or (15)),
+                ':DBG:', 'cmd_line', cmd_line))
+
+    # at least use `quiet` to suppress the setdefaultencoding warning
+    setdefaultencoding(quiet=_quiet or _parameters.test)
+    # |:opt:| handle options
+
+    # adhoc: implode/explode/extract
+    adhoc_export = (_parameters.explode or _parameters.extract)
+    adhoc_op = (_parameters.implode or adhoc_export or _parameters.template)
+    if adhoc_op:
+        file_ = __file__
+        source = None
+
+        have_adhoc = 'AdHoc' in globals()
+        have_rt_adhoc = 'RtAdHoc' in globals()
+
+        # shall adhoc be imported
+        if _parameters.implode or not have_rt_adhoc:
+            # shall this file be compiled
+            adhoc_compile = not (have_rt_adhoc)
+            os_path = os.defpath
+            for pv in ('PATH', 'path'):
+                try:
+                    os_path = os.environ[pv]
+                    break
+                except KeyError:
+                    pass
+            os_path = os_path.split(os.pathsep)
+            for path_dir in os_path:
+                if not path_dir:
+                    continue
+                if path_dir not in sys.path:
+                    sys.path.append(path_dir)
+            if not have_adhoc:
+                try:
+                    import adhoc
+                    AdHoc = adhoc.AdHoc
+                except ImportError:
+                    adhoc_compile = False
+                    try:
+                        from rt_adhoc import RtAdHoc as Adhoc
+                    except ImportError:
+                        pass
+        else:
+            adhoc_compile = False
+            AdHoc = RtAdHoc
+
+        AdHoc.quiet = _quiet
+        AdHoc.verbose = _verbose
+        AdHoc.debug = _debug
+        AdHoc.include_path.append(os.path.dirname(file_))
+
+        if adhoc_compile:
+            ah = AdHoc()
+            source = ah.compileFile(file_)
+        else:
+            file_, source = AdHoc.std_source_param(file_)
+
+        # implode
+        if _parameters.implode:
+            # @:adhoc_enable:@
+            # if not _quiet:
+            #     map(sys.stderr.write,
+            #         ["warning: ", os.path.basename(file_),
+            #          " already imploded!\n"])
+            # @:adhoc_enable:@
+            AdHoc.write_source('-', source)
+        # explode
+        elif _parameters.explode:
+            AdHoc.export_dir = _parameters.adhoc_arg
+            AdHoc.export(file_, source)
+        # extract
+        elif _parameters.extract:
+            AdHoc.extract_dir = _parameters.adhoc_arg
+            AdHoc.extract(file_, source)
+        # template
+        elif _parameters.template:
+            template_name = _parameters.adhoc_arg
+            if not template_name:
+                template_name = '-'
+            if template_name == 'list':
+                sys.stdout.write(
+                    '\n'.join(AdHoc.template_table(file_, source)) + '\n')
+            else:
+                template = AdHoc.get_named_template(
+                    template_name, file_, source)
+                AdHoc.write_source('-', template)
+
+        # restore for subsequent calls to main
+        if not have_adhoc:
+            del(AdHoc)
+        return 0
+
+    # run doc tests
+    if _parameters.test:
+        import doctest
+        doctest.testmod(verbose = _verbose)
+        return 0
+
+    # |:opt:| handle options
+    run(_parameters, _pass_opts)
+
+if '_is_main_' not in globals():
+    _is_main_ = (__name__ == '__main__')
+if _is_main_:
+    #sys.argv.insert(1, '--debug') # |:debug:|
+    result = main(sys.argv)
+    sys.exit(result)
+
+    # |:here:|
+
+# (progn (forward-line 1) (snip-insert-mode "py.t.ide" t) (insert "\n"))
+#
+# :ide-menu: Emacs IDE Main Menu - Buffer @BUFFER@
+# . M-x `eIDE-menu' (eIDE-menu "z")
+
+# :ide: CSCOPE ON
+# . (cscope-minor-mode)
+
+# :ide: CSCOPE OFF
+# . (cscope-minor-mode (quote ( nil )))
+
+# :ide: TAGS: forced update
+# . (compile (concat "cd /home/ws/project/ws-rfid && make -k FORCED=1 tags"))
+
+# :ide: TAGS: update
+# . (compile (concat "cd /home/ws/project/ws-rfid && make -k tags"))
+
+# :ide: +-#+
+# . Utilities ()
+
+# :ide: TOC: Generate TOC with py-toc.py
+# . (progn (save-buffer) (compile (concat "py-toc.py ./" (file-name-nondirectory (buffer-file-name)) " ")))
+
+# :ide: CMD: Fold region with line continuation
+# . (shell-command-on-region (region-beginning) (region-end) "fold --spaces -width 79 | sed 's, $,,;1!s,^, ,;$!s,$,\\\\,'" nil nil nil t)
+
+# :ide: CMD: Fold region and replace with line continuation
+# . (shell-command-on-region (region-beginning) (region-end) "fold --spaces --width 79 | sed 's, $,,;1!s,^, ,;$!s,$,\\\\,'" t nil nil t)
+
+# :ide: +-#+
+# . Fold ()
+
+# :ide: CMD: Remove 8 spaces and add `>>> ' to region
+# . (shell-command-on-region (region-beginning) (region-end) "sed 's,^        ,,;/^[ ]*##/d;/^[ ]*#/{;s,^ *# *,,p;d;};/^[ ]*$/!s,^,>>> ,'" nil nil nil t)
+
+# :ide: CMD: Remove 4 spaces and add `>>> ' to region
+# . (shell-command-on-region (region-beginning) (region-end) "sed 's,^    ,,;/^[ ]*##/d;/^[ ]*#/{;s,^ *# *,,p;d;};/^[ ]*$/!s,^,>>> ,'" nil nil nil t)
+
+# :ide: +-#+
+# . Doctest ()
+
+# :ide: LINT: Check 80 column width ignoring IDE Menus
+# . (let ((args " | /srv/ftp/pub/check-80-col.sh -")) (compile (concat "sed 's,^\\(\\|. \\|.. \\|... \\)\\(:ide\\|[.] \\).*,,' " (buffer-file-name) " " args " | sed 's,^-," (buffer-file-name) ",'")))
+
+# :ide: LINT: Check 80 column width
+# . (let ((args "")) (compile (concat "/srv/ftp/pub/check-80-col.sh " (buffer-file-name) " " args)))
+
+# :ide: +-#+
+# . Lint Tools ()
+
+# :ide: DELIM:     @: SYM :@         @:fillme:@             adhoc tag
+# . (symbol-tag-normalize-delimiter (cons (cons nil "@:") (cons ":@" nil)) t)
+
+# :ide: +-#+
+# . Delimiters ()
+
+# :ide: COMPILE: Run with --ap-help
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " --ap-help")))
+
+# :ide: COMPILE: Run with --help
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " --help")))
+
+# :ide: COMPILE: Run with --test
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " --test")))
+
+# :ide: COMPILE: Run with --test --verbose
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " --test --verbose")))
+
+# :ide: COMPILE: Run with --debug
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " --debug")))
+
+# :ide: +-#+
+# . Compile with standard arguments ()
+
+# :ide: OCCUR-OUTLINE: Python Source Code
+# . (x-symbol-tag-occur-outline "sec" '("|||:" ":|||") (cons (cons "^\\([ \t\r]*\\(def\\|class\\)[ ]+\\|[A-Za-z_]?\\)" nil) (cons nil "\\([ \t\r]*(\\|[ \t]*=\\)")))
+
+# :ide: MENU-OUTLINE: Python Source Code
+# . (x-eIDE-menu-outline "sec" '("|||:" ":|||") (cons (cons "^\\([ \t\r]*\\(def\\|class\\)[ ]+\\|[A-Za-z_]?\\)" nil) (cons nil "\\([ \t\r]*(\\|[ \t]*=\\)")))
+
+# :ide: +-#+
+# . Outline ()
+
+# :ide: INFO: SQLAlchemy - SQL Expression Language - Reference
+# . (let ((ref-buffer "*sqa-expr-ref*")) (if (not (get-buffer ref-buffer)) (shell-command (concat "w3m -dump -cols " (number-to-string (1- (window-width))) " 'http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/expressions.html'") ref-buffer) (display-buffer ref-buffer t)))
+
+# :ide: INFO: SQLAlchemy - SQL Expression Language - Tutorial
+# . (let ((ref-buffer "*sqa-expr-tutor*")) (if (not (get-buffer ref-buffer)) (shell-command (concat "w3m -dump -cols " (number-to-string (1- (window-width))) " 'http://www.sqlalchemy.org/docs/05/sqlexpression.html'") ref-buffer) (display-buffer ref-buffer t)))
+
+# :ide: INFO: SQLAlchemy - Query
+# . (let ((ref-buffer "*sqa-query*")) (if (not (get-buffer ref-buffer)) (shell-command (concat "w3m -dump -cols " (number-to-string (1- (window-width))) " 'http://www.sqlalchemy.org/docs/orm/query.html'") ref-buffer) (display-buffer ref-buffer t)))
+
+# :ide: +-#+
+# . SQLAlchemy Reference ()
+
+# :ide: INFO: Python - argparse
+# . (let ((ref-buffer "*python-argparse*")) (if (not (get-buffer ref-buffer)) (shell-command (concat "w3m -dump -cols " (number-to-string (1- (window-width))) " 'http://docs.python.org/library/argparse.html'") ref-buffer) (display-buffer ref-buffer t)))
+
+# :ide: INFO: Python Documentation
+# . (let ((ref-buffer "*w3m*")) (if (get-buffer ref-buffer) (display-buffer ref-buffer t)) (other-window 1) (w3m-goto-url "http://docs.python.org/index.html" nil nil))
+
+# :ide: INFO: Python Reference
+# . (let* ((ref-buffer "*python-ref*") (local "/home/ws/project/ws-util/python/reference/PQR2.7.html") (url (or (and (file-exists-p local) local) "'http://rgruet.free.fr/PQR27/PQR2.7.html'"))) (unless (get-buffer ref-buffer) (get-buffer-create ref-buffer) (with-current-buffer ref-buffer (shell-command (concat "snc txt.py.reference 2>/dev/null") ref-buffer) (goto-char (point-min)) (if (eobp) (shell-command (concat "w3m -dump -cols " (number-to-string (1- (window-width))) " " url) ref-buffer)))) (display-buffer ref-buffer t))
+
+# :ide: +-#+
+# . Python Reference ()
+
+# :ide: COMPILE: Run with python3 --test
+# . (progn (save-buffer) (compile (concat "python3 ./" (file-name-nondirectory (buffer-file-name)) "  --test")))
+
+# :ide: COMPILE: Run with python3 w/o args
+# . (progn (save-buffer) (compile (concat "python3 ./" (file-name-nondirectory (buffer-file-name)) " ")))
+
+# :ide: COMPILE: Run with --test
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " --test")))
+
+# :ide: COMPILE: Run w/o args
+# . (progn (save-buffer) (compile (concat "python ./" (file-name-nondirectory (buffer-file-name)) " ")))
+
+# :ide: +-#+
+# . Compile ()
+
+#
+# Local Variables:
+# mode: python
+# comment-start: "#"
+# comment-start-skip: "#+"
+# comment-column: 0
+# truncate-lines: t
+# End: