Пример #1
0
#!/usr/bin/env python
#
# pod2md.py: Convert perldoc-style POD markup to MarkDown-ish.
# Written 2019-02-19 by Steven J. DeRose.
#
from __future__ import print_function
import sys
import argparse
import re
import codecs
import PowerWalk
from typing import IO

from alogging import ALogger
lg = ALogger(1)

PY3 = sys.version_info[0] == 3
if PY3:
    from html import entities

    def unichr(n):
        return chr(n)


__metadata__ = {
    "title": "pod2md.py",
    "description": "Convert perldoc-style POD markup to MarkDown-ish.",
    "rightsHolder": "Steven J. DeRose",
    "creator": "http://viaf.org/viaf/50334488",
    "type": "http://purl.org/dc/dcmitype/Software",
    "language": "Python 3.7",
Пример #2
0
#!/usr/bin/env python
#
# findUnbalancedQuotes.py: Report lines with odd quotation patterns.
# 2017-07-03: Written by Steven J. DeRose.
#
import sys, os, argparse
import re
import codecs

from alogging import ALogger
lg = ALogger()

__metadata__ = {
    'title': "findUnbalancedQuotes.py",
    "description": "Report lines with odd quotation patterns.",
    'rightsHolder': "Steven J. DeRose",
    'creator': "http://viaf.org/viaf/50334488",
    'type': "http://purl.org/dc/dcmitype/Software",
    'language': "Python 3.7",
    'created': "2017-07-03",
    'modified': "2020-04-21",
    'publisher': "http://github.com/sderose",
    'license': "https://creativecommons.org/licenses/by-sa/3.0/",
}
__version__ = __metadata__['modified']

descr = """
=Description=

Scan for lines with imbalanced quotes.
Пример #3
0
#!/usr/bin/env python3  
#
# XmlNlpLoad.pm: "Pull text from XML and arrange for NLP tools.
# 2018-05-07: Written by Steven J. DeRose.
#
from __future__ import print_function

import xml.dom
import xml.dom.minidom
from DomExtensions import DomExtensions

from alogging import ALogger
lg = ALogger(1)

__metadata__ = {
    "title"        : "XmlNlpLoad",
    "description"  : "Pull text from XML and arrange for NLP tools.",
    "rightsHolder" : "Steven J. DeRose",
    "creator"      : "http://viaf.org/viaf/50334488",
    "type"         : "http://purl.org/dc/dcmitype/Software",
    "language"     : "Python 3.7",
    "created"      : "2018-05-07",
    "modified"     : "2021-03-03",
    "publisher"    : "http://github.com/sderose",
    "license"      : "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__["modified"]


descr = """
Пример #4
0
                            version='Version of ' + __version__,
                            help='Display version information, then exit.')

        parser.add_argument('dirs',
                            type=str,
                            nargs=argparse.REMAINDER,
                            help='Path(s) to input dir(s)')
        args0 = parser.parse_args()
        return args0

    ###########################################################################
    # Main
    #
    args = processOptions()

    lg = ALogger(1)

    if (args.all):
        args.backups = args.hidden = True

    if (not args.color):
        args.color = ("USE_COLOR" in os.environ and sys.stderr.isatty())
    lg.setColors(args.color)

    if (not (args.size or args.time or args.md5 or args.diff)):
        lg.vMsg(0,
                "No file comparisons specified (--size --time --md5 --diff)")

    if ("COLUMNS" in os.environ): wid = os.environ["COLUMNS"]
    else: wid = 80
Пример #5
0
#
import sys
import argparse
import re
import codecs
import unicodedata
from math import floor

from alogging import ALogger

#PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
    def unichr(nn): return chr(nn)

lg = ALogger(1)

__metadata__ = {
    'title'        : "makeCharChart.py",
    'description'  : "Display info on range of Unicode code points.",
    'rightsHolder' : "Steven J. DeRose",
    'creator'      : "http://viaf.org/viaf/50334488",
    'type'         : "http://purl.org/dc/dcmitype/Software",
    'language'     : "Python 2.7.6, 3.6",
    'created'      : "2013-04-24",
    'modified'     : "2020-02-14",
    'publisher'    : "http://github.com/sderose",
    'license'      : "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__['modified']
Пример #6
0
#!/usr/bin/env python3
#
# colorConvert.py: Normalize various color specs.
# 2016-04-14: Written. Copyright by Steven J. DeRose.
#
from __future__ import print_function
import sys
import os
import re
import math
import codecs
import colorsys
import webcolors

from alogging import ALogger
lg = ALogger(1)
palColors = {}

__metadata__ = {
    "title"        : "colorConvert.py",
    "description"  : "Normalize various color specs.",
    "rightsHolder" : "Steven J. DeRose",
    "creator"      : "http://viaf.org/viaf/50334488",
    "type"         : "http://purl.org/dc/dcmitype/Software",
    "language"     : "Python 3.7",
    "created"      : "2016-04-14",
    "modified"     : "2021-06-24",
    "publisher"    : "http://github.com/sderose",
    "license"      : "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__["modified"]
Пример #7
0
from typing import Dict, List  #, IO, Union
from enum import Enum

import mimetypes
from email import message_from_binary_file
from email.parser import BytesParser  #, Parser
from email.policy import default

#import string
#import math
#import subprocess
#from collections import defaultdict, namedtuple

from PowerWalk import PowerWalk, PWType
from alogging import ALogger
lg = ALogger()

__metadata__ = {
    "title": "getMimeBody.py",
    "description": " Extract the 'main' content of an email file.",
    "rightsHolder": "Steven J. DeRose",
    "creator": "http://viaf.org/viaf/50334488",
    "type": "http://purl.org/dc/dcmitype/Software",
    "language": "Python 3.7",
    "created": "2021-11-19",
    "modified": "2021-11-19",
    "publisher": "http://github.com/sderose",
    "license": "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__["modified"]
Пример #8
0
#!/usr/bin/env python
#
# makeVue.py: Create a Vue document with many boxes.
# 2016-02-08: Written by: Steven J. DeRose.
#
from __future__ import print_function
import sys
import os
import argparse
import re
import time

from alogging import ALogger
lg = ALogger(1)

__metadata__ = {
    'title': "makeVue.py",
    'description': "Create a Vue document with many boxes.",
    'rightsHolder': "Steven J. DeRose",
    'creator': "http://viaf.org/viaf/50334488",
    'type': "http://purl.org/dc/dcmitype/Software",
    'language': "Python 3.7",
    'created': "2016-02-08",
    'modified': "2020-03-04",
    'publisher': "http://github.com/sderose",
    'license': "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__['modified']

descr = """
=Description=
Пример #9
0
#!/usr/bin/env python
#
# sort.py
# 2018-07-18: Written by Steven J. DeRose.
#
from __future__ import print_function
import sys, os
import argparse
import re
import codecs

from alogging import ALogger
lg = ALogger(1)

__metadata__ = {
    "title": "sort.py",
    "description": "Do a really, really plain sort.",
    "rightsHolder": "Steven J. DeRose",
    "creator": "http://viaf.org/viaf/50334488",
    "type": "http://purl.org/dc/dcmitype/Software",
    "language": "Python 3.7",
    "created": "2018-07-18",
    "modified": "2021-03-03",
    "publisher": "http://github.com/sderose",
    "license": "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__["modified"]

descr = """
=Description=
Пример #10
0
#!/usr/bin/env python
#
# json2xml.py: Convert JSON to XML or other forms.
# Written 2012-12-04 by Steven J. DeRose.
#
from __future__ import print_function
import sys
import os
import re
import codecs
import json
#import pyxser  # https://sourceforge.net/projects/pyxser/

from PowerWalk import PowerWalk, PWType
from alogging import ALogger
lg = ALogger(1)

__metadata__ = {
    'title': "json2xml.py",
    'rightsHolder': "Steven J. DeRose",
    'creator': "http://viaf.org/viaf/50334488",
    'type': "http://purl.org/dc/dcmitype/Software",
    'language': "Python 3.7",
    'created': "2012-12-04",
    'modified': "2020-20-09",
    'publisher': "http://github.com/sderose",
    'license': "https://creativecommons.org/licenses/by-sa/3.0/"
}
__version__ = __metadata__['modified']

descr = """
Пример #11
0
#!/usr/bin/env python
#
# text2html.py: Convert simple text layouts to HTML.
# Written 2018-07-21 by Steven J. DeRose
#
from __future__ import print_function
import sys
import argparse
import re
import codecs

import XmlOutput
from alogging import ALogger
lg = ALogger(1)

__metadata__ = {
    "title"        : "text2html.py",
    "description"  : "Convert simple text layouts to HTML.",
    "rightsHolder" : "Steven J. DeRose",
    "creator"      : "http://viaf.org/viaf/50334488",
    "type"         : "http://purl.org/dc/dcmitype/Software",
    "language"     : "Python 3.7",
    "created"      : "2018-07-21",
    "modified"     : "2020-03-04",
    "publisher"    : "http://github.com/sderose",
    "license"      : "https://creativecommons.org/licenses/by-sa/3.0/",
}
__version__ = __metadata__["modified"]


descr = """