From 1dd3124a9770e11b6684e5dd1e6bc15a0aa3bc67 Mon Sep 17 00:00:00 2001 From: "Matth?us G. Chajdas" Date: Sun, 10 Nov 2019 13:56:53 +0100 Subject: Remove all files, redirect to GitHub. --- scripts/check_sources.py | 212 -------- scripts/debug_lexer.py | 246 --------- scripts/detect_missing_analyse_text.py | 33 -- scripts/epydoc.css | 280 ---------- scripts/find_error.py | 1 - scripts/get_vimkw.py | 74 --- scripts/pylintrc | 301 ----------- scripts/release-checklist | 24 - scripts/vim2pygments.py | 935 --------------------------------- 9 files changed, 2106 deletions(-) delete mode 100755 scripts/check_sources.py delete mode 100755 scripts/debug_lexer.py delete mode 100644 scripts/detect_missing_analyse_text.py delete mode 100644 scripts/epydoc.css delete mode 120000 scripts/find_error.py delete mode 100644 scripts/get_vimkw.py delete mode 100644 scripts/pylintrc delete mode 100644 scripts/release-checklist delete mode 100755 scripts/vim2pygments.py (limited to 'scripts') diff --git a/scripts/check_sources.py b/scripts/check_sources.py deleted file mode 100755 index f047168c..00000000 --- a/scripts/check_sources.py +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Checker for file headers - ~~~~~~~~~~~~~~~~~~~~~~~~ - - Make sure each Python file has a correct file header - including copyright and license information. - - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from __future__ import print_function - -import io -import os -import re -import sys -import getopt -from os.path import join, splitext, abspath - - -checkers = {} - - -def checker(*suffixes, **kwds): - only_pkg = kwds.pop('only_pkg', False) - - def deco(func): - for suffix in suffixes: - checkers.setdefault(suffix, []).append(func) - func.only_pkg = only_pkg - return func - return deco - - -name_mail_re = r'[\w ]+(<.*?>)?' -copyright_re = re.compile(r'^ :copyright: Copyright 2006-2019 by ' - r'the Pygments team, see AUTHORS\.$', re.UNICODE) -copyright_2_re = re.compile(r'^ %s(, %s)*[,.]$' % - (name_mail_re, name_mail_re), re.UNICODE) -is_const_re = re.compile(r'if.*?==\s+(None|False|True)\b') - -misspellings = ["developement", "adress", "verificate", # ALLOW-MISSPELLING - "informations", "unlexer"] # ALLOW-MISSPELLING - - -@checker('.py') -def check_syntax(fn, lines): - if '#!/' in lines[0]: - lines = lines[1:] - if 'coding:' in lines[0]: - lines = lines[1:] - try: - compile('\n'.join(lines), fn, "exec") - except SyntaxError as err: - yield 0, "not compilable: %s" % err - - -@checker('.py') -def check_style_and_encoding(fn, lines): - for lno, line in enumerate(lines): - if len(line) > 110: - yield lno+1, "line too long" - if is_const_re.search(line): - yield lno+1, 'using == None/True/False' - - -@checker('.py', only_pkg=True) -def check_fileheader(fn, lines): - # line number correction - c = 1 - if lines[0:1] == ['#!/usr/bin/env python']: - lines = lines[1:] - c = 2 - - llist = [] - docopen = False - for lno, l in enumerate(lines): - llist.append(l) - if lno == 0: - if l != '# -*- coding: utf-8 -*-': - yield 1, "missing coding declaration" - elif lno == 1: - if l != '"""' and l != 'r"""': - yield 2, 'missing docstring begin (""")' - else: - docopen = True - elif docopen: - if l == '"""': - # end of docstring - if lno <= 4: - yield lno+c, "missing module name in docstring" - break - - if l != "" and l[:4] != ' ' and docopen: - yield lno+c, "missing correct docstring indentation" - - if lno == 2: - # if not in package, don't check the module name - modname = fn[:-3].replace('/', '.').replace('.__init__', '') - while modname: - if l.lower()[4:] == modname: - break - modname = '.'.join(modname.split('.')[1:]) - else: - yield 3, "wrong module name in docstring heading" - modnamelen = len(l.strip()) - elif lno == 3: - if l.strip() != modnamelen * "~": - yield 4, "wrong module name underline, should be ~~~...~" - - else: - yield 0, "missing end and/or start of docstring..." - - # check for copyright and license fields - license = llist[-2:-1] - if license != [" :license: BSD, see LICENSE for details."]: - yield 0, "no correct license info" - - ci = -3 - copyright = llist[ci:ci+1] - while copyright and copyright_2_re.match(copyright[0]): - ci -= 1 - copyright = llist[ci:ci+1] - if not copyright or not copyright_re.match(copyright[0]): - yield 0, "no correct copyright info" - - -def main(argv): - try: - gopts, args = getopt.getopt(argv[1:], "vi:") - except getopt.GetoptError: - print("Usage: %s [-v] [-i ignorepath]* [path]" % argv[0]) - return 2 - opts = {} - for opt, val in gopts: - if opt == '-i': - val = abspath(val) - opts.setdefault(opt, []).append(val) - - if len(args) == 0: - path = '.' - elif len(args) == 1: - path = args[0] - else: - print("Usage: %s [-v] [-i ignorepath]* [path]" % argv[0]) - return 2 - - verbose = '-v' in opts - - num = 0 - out = io.StringIO() - - # TODO: replace os.walk run with iteration over output of - # `svn list -R`. - - for root, dirs, files in os.walk(path): - if '.hg' in dirs: - dirs.remove('.hg') - if 'examplefiles' in dirs: - dirs.remove('examplefiles') - if '-i' in opts and abspath(root) in opts['-i']: - del dirs[:] - continue - # XXX: awkward: for the Makefile call: don't check non-package - # files for file headers - in_pygments_pkg = root.startswith('./pygments') - for fn in files: - - fn = join(root, fn) - if fn[:2] == './': - fn = fn[2:] - - if '-i' in opts and abspath(fn) in opts['-i']: - continue - - ext = splitext(fn)[1] - checkerlist = checkers.get(ext, None) - if not checkerlist: - continue - - if verbose: - print("Checking %s..." % fn) - - try: - with open(fn, 'rb') as f: - lines = f.read().decode('utf-8').splitlines() - except (IOError, OSError) as err: - print("%s: cannot open: %s" % (fn, err)) - num += 1 - continue - - for checker in checkerlist: - if not in_pygments_pkg and checker.only_pkg: - continue - for lno, msg in checker(fn, lines): - print(u"%s:%d: %s" % (fn, lno, msg), file=out) - num += 1 - if verbose: - print() - if num == 0: - print("No errors found.") - else: - print(out.getvalue().rstrip('\n')) - print("%d error%s found." % (num, num > 1 and "s" or "")) - return int(num > 0) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py deleted file mode 100755 index ef01a23f..00000000 --- a/scripts/debug_lexer.py +++ /dev/null @@ -1,246 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -""" - Lexing error finder - ~~~~~~~~~~~~~~~~~~~ - - For the source files given on the command line, display - the text where Error tokens are being generated, along - with some context. - - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from __future__ import print_function - -import os -import sys - -# always prefer Pygments from source if exists -srcpath = os.path.join(os.path.dirname(__file__), '..') -if os.path.isdir(os.path.join(srcpath, 'pygments')): - sys.path.insert(0, srcpath) - - -from pygments.lexer import RegexLexer, ExtendedRegexLexer, LexerContext, \ - ProfilingRegexLexer, ProfilingRegexLexerMeta -from pygments.lexers import get_lexer_by_name, find_lexer_class, \ - find_lexer_class_for_filename -from pygments.token import Error, Text, _TokenType -from pygments.cmdline import _parse_options - - -class DebuggingRegexLexer(ExtendedRegexLexer): - """Make the state stack, position and current match instance attributes.""" - - def get_tokens_unprocessed(self, text, stack=('root',)): - """ - Split ``text`` into (tokentype, text) pairs. - - ``stack`` is the inital stack (default: ``['root']``) - """ - tokendefs = self._tokens - self.ctx = ctx = LexerContext(text, 0) - ctx.stack = list(stack) - statetokens = tokendefs[ctx.stack[-1]] - while 1: - for rexmatch, action, new_state in statetokens: - self.m = m = rexmatch(text, ctx.pos, ctx.end) - if m: - if action is not None: - if type(action) is _TokenType: - yield ctx.pos, action, m.group() - ctx.pos = m.end() - else: - if not isinstance(self, ExtendedRegexLexer): - for item in action(self, m): - yield item - ctx.pos = m.end() - else: - for item in action(self, m, ctx): - yield item - if not new_state: - # altered the state stack? - statetokens = tokendefs[ctx.stack[-1]] - if new_state is not None: - # state transition - if isinstance(new_state, tuple): - for state in new_state: - if state == '#pop': - ctx.stack.pop() - elif state == '#push': - ctx.stack.append(ctx.stack[-1]) - else: - ctx.stack.append(state) - elif isinstance(new_state, int): - # pop - del ctx.stack[new_state:] - elif new_state == '#push': - ctx.stack.append(ctx.stack[-1]) - else: - assert False, 'wrong state def: %r' % new_state - statetokens = tokendefs[ctx.stack[-1]] - break - else: - try: - if ctx.pos >= ctx.end: - break - if text[ctx.pos] == '\n': - # at EOL, reset state to 'root' - ctx.stack = ['root'] - statetokens = tokendefs['root'] - yield ctx.pos, Text, u'\n' - ctx.pos += 1 - continue - yield ctx.pos, Error, text[ctx.pos] - ctx.pos += 1 - except IndexError: - break - - -def main(fn, lexer=None, options={}): - if lexer is not None: - lxcls = get_lexer_by_name(lexer).__class__ - else: - lxcls = find_lexer_class_for_filename(os.path.basename(fn)) - if lxcls is None: - name, rest = fn.split('_', 1) - lxcls = find_lexer_class(name) - if lxcls is None: - raise AssertionError('no lexer found for file %r' % fn) - print('Using lexer: %s (%s.%s)' % (lxcls.name, lxcls.__module__, - lxcls.__name__)) - debug_lexer = False - # if profile: - # # does not work for e.g. ExtendedRegexLexers - # if lxcls.__bases__ == (RegexLexer,): - # # yes we can! (change the metaclass) - # lxcls.__class__ = ProfilingRegexLexerMeta - # lxcls.__bases__ = (ProfilingRegexLexer,) - # lxcls._prof_sort_index = profsort - # else: - # if lxcls.__bases__ == (RegexLexer,): - # lxcls.__bases__ = (DebuggingRegexLexer,) - # debug_lexer = True - # elif lxcls.__bases__ == (DebuggingRegexLexer,): - # # already debugged before - # debug_lexer = True - # else: - # # HACK: ExtendedRegexLexer subclasses will only partially work here. - # lxcls.__bases__ = (DebuggingRegexLexer,) - # debug_lexer = True - - lx = lxcls(**options) - lno = 1 - if fn == '-': - text = sys.stdin.read() - else: - with open(fn, 'rb') as fp: - text = fp.read().decode('utf-8') - text = text.strip('\n') + '\n' - tokens = [] - states = [] - - def show_token(tok, state): - reprs = list(map(repr, tok)) - print(' ' + reprs[1] + ' ' + ' ' * (29-len(reprs[1])) + reprs[0], end=' ') - if debug_lexer: - print(' ' + ' ' * (29-len(reprs[0])) + ' : '.join(state) if state else '', end=' ') - print() - - for type, val in lx.get_tokens(text): - lno += val.count('\n') - if type == Error and not ignerror: - print('Error parsing', fn, 'on line', lno) - if not showall: - print('Previous tokens' + (debug_lexer and ' and states' or '') + ':') - for i in range(max(len(tokens) - num, 0), len(tokens)): - if debug_lexer: - show_token(tokens[i], states[i]) - else: - show_token(tokens[i], None) - print('Error token:') - l = len(repr(val)) - print(' ' + repr(val), end=' ') - if debug_lexer and hasattr(lx, 'ctx'): - print(' ' * (60-l) + ' : '.join(lx.ctx.stack), end=' ') - print() - print() - return 1 - tokens.append((type, val)) - if debug_lexer: - if hasattr(lx, 'ctx'): - states.append(lx.ctx.stack[:]) - else: - states.append(None) - if showall: - show_token((type, val), states[-1] if debug_lexer else None) - return 0 - - -def print_help(): - print('''\ -Pygments development helper to quickly debug lexers. - - scripts/debug_lexer.py [options] file ... - -Give one or more filenames to lex them and display possible error tokens -and/or profiling info. Files are assumed to be encoded in UTF-8. - -Selecting lexer and options: - - -l NAME use lexer named NAME (default is to guess from - the given filenames) - -O OPTIONSTR use lexer options parsed from OPTIONSTR - -Debugging lexing errors: - - -n N show the last N tokens on error - -a always show all lexed tokens (default is only - to show them when an error occurs) - -e do not stop on error tokens - -Profiling: - - -p use the ProfilingRegexLexer to profile regexes - instead of the debugging lexer - -s N sort profiling output by column N (default is - column 4, the time per call) -''') - -num = 10 -showall = False -ignerror = False -lexer = None -options = {} -profile = False -profsort = 4 - -if __name__ == '__main__': - import getopt - opts, args = getopt.getopt(sys.argv[1:], 'n:l:aepO:s:h') - for opt, val in opts: - if opt == '-n': - num = int(val) - elif opt == '-a': - showall = True - elif opt == '-e': - ignerror = True - elif opt == '-l': - lexer = val - elif opt == '-p': - profile = True - elif opt == '-s': - profsort = int(val) - elif opt == '-O': - options = _parse_options([val]) - elif opt == '-h': - print_help() - sys.exit(0) - ret = 0 - if not args: - print_help() - for f in args: - ret += main(f, lexer, options) - sys.exit(bool(ret)) diff --git a/scripts/detect_missing_analyse_text.py b/scripts/detect_missing_analyse_text.py deleted file mode 100644 index ab58558e..00000000 --- a/scripts/detect_missing_analyse_text.py +++ /dev/null @@ -1,33 +0,0 @@ -from __future__ import print_function -import sys - -from pygments.lexers import get_all_lexers, find_lexer_class -from pygments.lexer import Lexer - -def main(): - uses = {} - - for name, aliases, filenames, mimetypes in get_all_lexers(): - cls = find_lexer_class(name) - if not cls.aliases: - print(cls, "has no aliases") - for f in filenames: - if f not in uses: - uses[f] = [] - uses[f].append(cls) - - ret = 0 - for k, v in uses.items(): - if len(v) > 1: - #print "Multiple for", k, v - for i in v: - if i.analyse_text is None: - print(i, "has a None analyse_text") - ret |= 1 - elif Lexer.analyse_text.__doc__ == i.analyse_text.__doc__: - print(i, "needs analyse_text, multiple lexers for", k) - ret |= 2 - return ret - -if __name__ == '__main__': - sys.exit(main()) diff --git a/scripts/epydoc.css b/scripts/epydoc.css deleted file mode 100644 index 16d5b0df..00000000 --- a/scripts/epydoc.css +++ /dev/null @@ -1,280 +0,0 @@ - - -/* Epydoc CSS Stylesheet - * - * This stylesheet can be used to customize the appearance of epydoc's - * HTML output. - * - */ - -/* Adapted for Pocoo API docs by Georg Brandl */ - -/* Default Colors & Styles - * - Set the default foreground & background color with 'body'; and - * link colors with 'a:link' and 'a:visited'. - * - Use bold for decision list terms. - * - The heading styles defined here are used for headings *within* - * docstring descriptions. All headings used by epydoc itself use - * either class='epydoc' or class='toc' (CSS styles for both - * defined below). - */ -body { background: #ffffff; color: #000000; - font-family: Trebuchet MS,Tahoma,sans-serif; - font-size: 0.9em; line-height: 140%; - margin: 0; padding: 0 1.2em 1.2em 1.2em; } -a:link { color: #C87900; text-decoration: none; - border-bottom: 1px solid #C87900; } -a:visited { color: #C87900; text-decoration: none; - border-bottom: 1px dotted #C87900; } -a:hover { color: #F8A900; border-bottom-color: #F8A900; } -dt { font-weight: bold; } -h1 { font-size: +180%; font-style: italic; - font-weight: bold; margin-top: 1.5em; } -h2 { font-size: +140%; font-style: italic; - font-weight: bold; } -h3 { font-size: +110%; font-style: italic; - font-weight: normal; } -p { margin-top: .5em; margin-bottom: .5em; } -hr { margin-top: 1.5em; margin-bottom: 1.5em; - border: 1px solid #BBB; } -tt.literal { background: #F5FFD0; padding: 2px; - font-size: 110%; } -table.rst-docutils { border: 0; } -table.rst-docutils td { border: 0; padding: 5px 20px 5px 0px; } - -/* Page Header & Footer - * - The standard page header consists of a navigation bar (with - * pointers to standard pages such as 'home' and 'trees'); a - * breadcrumbs list, which can be used to navigate to containing - * classes or modules; options links, to show/hide private - * variables and to show/hide frames; and a page title (using - *

). The page title may be followed by a link to the - * corresponding source code (using 'span.codelink'). - * - The footer consists of a navigation bar, a timestamp, and a - * pointer to epydoc's homepage. - */ -h1.epydoc { margin-top: .4em; margin-bottom: .4em; - font-size: +180%; font-weight: bold; - font-style: normal; } -h2.epydoc { font-size: +130%; font-weight: bold; - font-style: normal; } -h3.epydoc { font-size: +115%; font-weight: bold; - font-style: normal; } -table.navbar { background: #E6F8A0; color: #000000; - border-top: 1px solid #c0d0d0; - border-bottom: 1px solid #c0d0d0; - margin: -1px -1.2em 1em -1.2em; } -table.navbar th { padding: 2px 7px 2px 0px; } -th.navbar-select { background-color: transparent; } -th.navbar-select:before { content: ">" } -th.navbar-select:after { content: "<" } -table.navbar a { border: 0; } -span.breadcrumbs { font-size: 95%; font-weight: bold; } -span.options { font-size: 80%; } -span.codelink { font-size: 85%; } -td.footer { font-size: 85%; } - -/* Table Headers - * - Each summary table and details section begins with a 'header' - * row. This row contains a section title (marked by - * 'span.table-header') as well as a show/hide private link - * (marked by 'span.options', defined above). - * - Summary tables that contain user-defined groups mark those - * groups using 'group header' rows. - */ -td.table-header { background: #B6C870; color: #000000; - border-bottom: 1px solid #FFF; } -span.table-header { font-size: 110%; font-weight: bold; } -th.group-header { text-align: left; font-style: italic; - font-size: 110%; } -td.spacer { width: 5%; } - -/* Summary Tables (functions, variables, etc) - * - Each object is described by a single row of the table with - * two cells. The left cell gives the object's type, and is - * marked with 'code.summary-type'. The right cell gives the - * object's name and a summary description. - * - CSS styles for the table's header and group headers are - * defined above, under 'Table Headers' - */ -table.summary { border-collapse: collapse; - background: #E6F8A0; color: #000000; - margin: 1em 0 .5em 0; - border: 0; } -table.summary tr { border-bottom: 1px solid #BBB; } -td.summary a { font-weight: bold; } -code.summary-type { font-size: 85%; } - -/* Details Tables (functions, variables, etc) - * - Each object is described in its own single-celled table. - * - A single-row summary table w/ table-header is used as - * a header for each details section (CSS style for table-header - * is defined above, under 'Table Headers'). - */ - -table.detsummary { margin-top: 2em; } - -table.details { border-collapse: collapse; - background: #E6F8A0; color: #000000; - border-bottom: 1px solid #BBB; - margin: 0; } -table.details td { padding: .2em .2em .2em .5em; } -table.details table td { padding: 0; } -table.details h3 { margin: 5px 0 5px 0; font-size: 105%; - font-style: normal; } - -table.details dd { display: inline; margin-left: 5px; } -table.details dl { margin-left: 5px; } - - -/* Index tables (identifier index, term index, etc) - * - link-index is used for indices containing lists of links - * (namely, the identifier index & term index). - * - index-where is used in link indices for the text indicating - * the container/source for each link. - * - metadata-index is used for indices containing metadata - * extracted from fields (namely, the bug index & todo index). - */ -table.link-index { border-collapse: collapse; - background: #F6FFB0; color: #000000; - border: 1px solid #608090; } -td.link-index { border-width: 0px; } -span.index-where { font-size: 70%; } -table.metadata-index { border-collapse: collapse; - background: #F6FFB0; color: #000000; - border: 1px solid #608090; - margin: .2em 0 0 0; } -td.metadata-index { border-width: 1px; border-style: solid; } - -/* Function signatures - * - sig* is used for the signature in the details section. - * - .summary-sig* is used for the signature in the summary - * table, and when listing property accessor functions. - * */ -.sig-name { color: #006080; } -.sig-arg { color: #008060; } -.sig-default { color: #602000; } -.summary-sig-name { font-weight: bold; } -.summary-sig-arg { color: #006040; } -.summary-sig-default { color: #501800; } - -/* Variable values - * - In the 'variable details' sections, each varaible's value is - * listed in a 'pre.variable' box. The width of this box is - * restricted to 80 chars; if the value's repr is longer than - * this it will be wrapped, using a backslash marked with - * class 'variable-linewrap'. If the value's repr is longer - * than 3 lines, the rest will be ellided; and an ellipsis - * marker ('...' marked with 'variable-ellipsis') will be used. - * - If the value is a string, its quote marks will be marked - * with 'variable-quote'. - * - If the variable is a regexp, it is syntax-highlighted using - * the re* CSS classes. - */ -pre.variable { padding: .5em; margin: 0; - background-color: #dce4ec; - border: 1px solid #708890; } -.variable-linewrap { display: none; } -.variable-ellipsis { color: #604000; font-weight: bold; } -.variable-quote { color: #604000; font-weight: bold; } -.re { color: #000000; } -.re-char { color: #006030; } -.re-op { color: #600000; } -.re-group { color: #003060; } -.re-ref { color: #404040; } - -/* Base tree - * - Used by class pages to display the base class hierarchy. - */ -pre.base-tree { font-size: 90%; margin: 1em 0 2em 0; - line-height: 100%;} - -/* Frames-based table of contents headers - * - Consists of two frames: one for selecting modules; and - * the other listing the contents of the selected module. - * - h1.toc is used for each frame's heading - * - h2.toc is used for subheadings within each frame. - */ -h1.toc { text-align: center; font-size: 105%; - margin: 0; font-weight: bold; - padding: 0; } -h2.toc { font-size: 100%; font-weight: bold; - margin: 0.5em 0 0 -0.3em; } - -/* Syntax Highlighting for Source Code - * - doctest examples are displayed in a 'pre.py-doctest' block. - * If the example is in a details table entry, then it will use - * the colors specified by the 'table pre.py-doctest' line. - * - Source code listings are displayed in a 'pre.py-src' block. - * Each line is marked with 'span.py-line' (used to draw a line - * down the left margin, separating the code from the line - * numbers). Line numbers are displayed with 'span.py-lineno'. - * The expand/collapse block toggle button is displayed with - * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not - * modify the font size of the text.) - * - If a source code page is opened with an anchor, then the - * corresponding code block will be highlighted. The code - * block's header is highlighted with 'py-highlight-hdr'; and - * the code block's body is highlighted with 'py-highlight'. - * - The remaining py-* classes are used to perform syntax - * highlighting (py-string for string literals, py-name for names, - * etc.) - */ -pre.rst-literal-block, -pre.py-doctest { margin-left: 1em; margin-right: 1.5em; - line-height: 150%; - background-color: #F5FFD0; padding: .5em; - border: 1px solid #B6C870; - font-size: 110%; } -pre.py-src { border: 1px solid #BBB; margin-top: 3em; - background: #f0f0f0; color: #000000; - line-height: 150%; } -span.py-line { margin-left: .2em; padding-left: .4em; } -span.py-lineno { border-right: 1px solid #BBB; - padding: .3em .5em .3em .5em; - font-style: italic; font-size: 90%; } -a.py-toggle { text-decoration: none; } -div.py-highlight-hdr { border-top: 1px solid #BBB; - background: #d0e0e0; } -div.py-highlight { border-bottom: 1px solid #BBB; - background: #d0e0e0; } -.py-prompt { color: #005050; font-weight: bold;} -.py-string { color: #006030; } -.py-comment { color: #003060; } -.py-keyword { color: #600000; } -.py-output { color: #404040; } -.py-name { color: #000050; } -.py-name:link { color: #000050; } -.py-name:visited { color: #000050; } -.py-number { color: #005000; } -.py-def-name { color: #000060; font-weight: bold; } -.py-base-class { color: #000060; } -.py-param { color: #000060; } -.py-docstring { color: #006030; } -.py-decorator { color: #804020; } -/* Use this if you don't want links to names underlined: */ -/*a.py-name { text-decoration: none; }*/ - -/* Graphs & Diagrams - * - These CSS styles are used for graphs & diagrams generated using - * Graphviz dot. 'img.graph-without-title' is used for bare - * diagrams (to remove the border created by making the image - * clickable). - */ -img.graph-without-title { border: none; } -img.graph-with-title { border: 1px solid #000000; } -span.graph-title { font-weight: bold; } -span.graph-caption { } - -/* General-purpose classes - * - 'p.indent-wrapped-lines' defines a paragraph whose first line - * is not indented, but whose subsequent lines are. - * - The 'nomargin-top' class is used to remove the top margin (e.g. - * from lists). The 'nomargin' class is used to remove both the - * top and bottom margin (but not the left or right margin -- - * for lists, that would cause the bullets to disappear.) - */ -p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; - margin: 0; } -.nomargin-top { margin-top: 0; } -.nomargin { margin-top: 0; margin-bottom: 0; } diff --git a/scripts/find_error.py b/scripts/find_error.py deleted file mode 120000 index ba0b76f1..00000000 --- a/scripts/find_error.py +++ /dev/null @@ -1 +0,0 @@ -debug_lexer.py \ No newline at end of file diff --git a/scripts/get_vimkw.py b/scripts/get_vimkw.py deleted file mode 100644 index a1b6873e..00000000 --- a/scripts/get_vimkw.py +++ /dev/null @@ -1,74 +0,0 @@ -from __future__ import print_function - -import re - -from pygments.util import format_lines - -r_line = re.compile(r"^(syn keyword vimCommand contained|syn keyword vimOption " - r"contained|syn keyword vimAutoEvent contained)\s+(.*)") -r_item = re.compile(r"(\w+)(?:\[(\w+)\])?") - -HEADER = '''\ -# -*- coding: utf-8 -*- -""" - pygments.lexers._vim_builtins - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - This file is autogenerated by scripts/get_vimkw.py - - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -# Split up in multiple functions so it's importable by jython, which has a -# per-method size limit. -''' - -METHOD = '''\ -def _get%(key)s(): -%(body)s - return var -%(key)s = _get%(key)s() -''' - -def getkw(input, output): - out = file(output, 'w') - - # Copy template from an existing file. - print(HEADER, file=out) - - output_info = {'command': [], 'option': [], 'auto': []} - for line in file(input): - m = r_line.match(line) - if m: - # Decide which output gets mapped to d - if 'vimCommand' in m.group(1): - d = output_info['command'] - elif 'AutoEvent' in m.group(1): - d = output_info['auto'] - else: - d = output_info['option'] - - # Extract all the shortened versions - for i in r_item.finditer(m.group(2)): - d.append('(%r,%r)' % - (i.group(1), "%s%s" % (i.group(1), i.group(2) or ''))) - - output_info['option'].append("('nnoremap','nnoremap')") - output_info['option'].append("('inoremap','inoremap')") - output_info['option'].append("('vnoremap','vnoremap')") - - for key, keywordlist in output_info.items(): - keywordlist.sort() - body = format_lines('var', keywordlist, raw=True, indent_level=1) - print(METHOD % locals(), file=out) - -def is_keyword(w, keywords): - for i in range(len(w), 0, -1): - if w[:i] in keywords: - return keywords[w[:i]][:len(w)] == w - return False - -if __name__ == "__main__": - getkw("/usr/share/vim/vim74/syntax/vim.vim", - "pygments/lexers/_vim_builtins.py") diff --git a/scripts/pylintrc b/scripts/pylintrc deleted file mode 100644 index aa04e12e..00000000 --- a/scripts/pylintrc +++ /dev/null @@ -1,301 +0,0 @@ -# lint Python modules using external checkers. -# -# This is the main checker controling the other ones and the reports -# generation. It is itself both a raw checker and an astng checker in order -# to: -# * handle message activation / deactivation at the module level -# * handle some basic but necessary stats'data (number of classes, methods...) -# -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Profiled execution. -profile=no - -# Add to the black list. It should be a base name, not a -# path. You may set this option multiple times. -ignore=.svn - -# Pickle collected data for later comparisons. -persistent=yes - -# Set the cache size for astng objects. -cache-size=500 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable only checker(s) with the given id(s). This option conflict with the -# disable-checker option -#enable-checker= - -# Enable all checker(s) except those with the given id(s). This option conflict -# with the disable-checker option -#disable-checker= - -# Enable all messages in the listed categories. -#enable-msg-cat= - -# Disable all messages in the listed categories. -#disable-msg-cat= - -# Enable the message(s) with the given id(s). -#enable-msg= - -# Disable the message(s) with the given id(s). -disable-msg=C0323,W0142,C0301,C0103,C0111,E0213,C0302,C0203,W0703,R0201 - - -[REPORTS] - -# set the output format. Available formats are text, parseable, colorized and -# html -output-format=colorized - -# Include message's id in output -include-ids=yes - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells wether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note).You have access to the variables errors warning, statement which -# respectivly contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (R0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (R0004). -comment=no - -# Enable the report(s) with the given id(s). -#enable-report= - -# Disable the report(s) with the given id(s). -#disable-report= - - -# checks for -# * unused variables / imports -# * undefined variables -# * redefinition of variable from builtins or from an outer scope -# * use of variable before assigment -# -[VARIABLES] - -# Tells wether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching names used for dummy variables (i.e. not used). -dummy-variables-rgx=_|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -# try to find bugs in the code using type inference -# -[TYPECHECK] - -# Tells wether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# When zope mode is activated, consider the acquired-members option to ignore -# access to some undefined attributes. -zope=no - -# List of members which are usually get through zope's acquisition mecanism and -# so shouldn't trigger E0201 when accessed (need zope=yes to be considered). -acquired-members=REQUEST,acl_users,aq_parent - - -# checks for : -# * doc strings -# * modules / classes / functions / methods / arguments / variables name -# * number of arguments, local variables, branchs, returns and statements in -# functions, methods -# * required module attributes -# * dangerous default values as arguments -# * redefinition of function / method / class -# * uses of the global statement -# -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__ - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# List of builtins function names that should not be used, separated by a comma -bad-functions=apply,input - - -# checks for sign of poor/misdesign: -# * number of methods, attributes, local variables... -# * size, complexity of functions, methods -# -[DESIGN] - -# Maximum number of arguments for function / method -max-args=12 - -# Maximum number of locals for function / method body -max-locals=30 - -# Maximum number of return / yield for function / method body -max-returns=12 - -# Maximum number of branch for function / method body -max-branchs=30 - -# Maximum number of statements in function / method body -max-statements=60 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=20 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=0 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -# checks for -# * external modules dependencies -# * relative / wildcard imports -# * cyclic imports -# * uses of deprecated modules -# -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report R0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report R0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report R0402 must -# not be disabled) -int-import-graph= - - -# checks for : -# * methods without self as first argument -# * overridden methods signature -# * access only to existant members via self -# * attributes not defined in the __init__ method -# * supported interfaces implementation -# * unreachable code -# -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - - -# checks for similarities and duplicated code. This computation may be -# memory / CPU intensive, so you should disable it if you experiments some -# problems. -# -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=10 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - - -# checks for: -# * warning notes in the code like FIXME, XXX -# * PEP 263: source code with non ascii character but no encoding declaration -# -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -# checks for : -# * unauthorized constructions -# * strict indentation -# * line length -# * use of <> instead of != -# -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=90 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' diff --git a/scripts/release-checklist b/scripts/release-checklist deleted file mode 100644 index efc1e1e8..00000000 --- a/scripts/release-checklist +++ /dev/null @@ -1,24 +0,0 @@ -Release checklist -================= - -* Check ``hg status`` -* ``make check`` -* LATER when configured properly: ``make pylint`` -* ``tox`` -* Update version info in ``setup.py/__init__.py`` -* Check setup.py metadata: long description, trove classifiers -* Update release date/code name in ``CHANGES`` -* ``hg commit`` -* ``make clean`` -* ``python2 setup.py release bdist_wheel`` -* ``python3 setup.py release bdist_wheel sdist`` -* ``twine upload dist/Pygments-$NEWVER*`` -* Check PyPI release page for obvious errors -* ``hg tag`` -* Merge default into stable if this was a ``x.y.0`` -* Update homepage (release info), regenerate docs (+printable!) -* Add new version/milestone to tracker categories -* Write announcement and send to mailing list/python-announce -* Update version info, add new ``CHANGES`` entry for next version -* ``hg commit`` -* ``hg push`` diff --git a/scripts/vim2pygments.py b/scripts/vim2pygments.py deleted file mode 100755 index 42af0bbe..00000000 --- a/scripts/vim2pygments.py +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Vim Colorscheme Converter - ~~~~~~~~~~~~~~~~~~~~~~~~~ - - This script converts vim colorscheme files to valid pygments - style classes meant for putting into modules. - - :copyright 2006 by Armin Ronacher. - :license: BSD, see LICENSE for details. -""" - -from __future__ import print_function - -import sys -import re -from os import path -from io import StringIO - -split_re = re.compile(r'(? 2 and \ - len(parts[0]) >= 2 and \ - 'highlight'.startswith(parts[0]): - token = parts[1].lower() - if token not in TOKENS: - continue - for item in parts[2:]: - p = item.split('=', 1) - if not len(p) == 2: - continue - key, value = p - if key in ('ctermfg', 'guifg'): - color = get_vim_color(value) - if color: - set('color', color) - elif key in ('ctermbg', 'guibg'): - color = get_vim_color(value) - if color: - set('bgcolor', color) - elif key in ('term', 'cterm', 'gui'): - items = value.split(',') - for item in items: - item = item.lower() - if item == 'none': - set('noinherit', True) - elif item == 'bold': - set('bold', True) - elif item == 'underline': - set('underline', True) - elif item == 'italic': - set('italic', True) - - if bg_color is not None and not colors['Normal'].get('bgcolor'): - colors['Normal']['bgcolor'] = bg_color - - color_map = {} - for token, styles in colors.items(): - if token in TOKENS: - tmp = [] - if styles.get('noinherit'): - tmp.append('noinherit') - if 'color' in styles: - tmp.append(styles['color']) - if 'bgcolor' in styles: - tmp.append('bg:' + styles['bgcolor']) - if styles.get('bold'): - tmp.append('bold') - if styles.get('italic'): - tmp.append('italic') - if styles.get('underline'): - tmp.append('underline') - tokens = TOKENS[token] - if not isinstance(tokens, tuple): - tokens = (tokens,) - for token in tokens: - color_map[token] = ' '.join(tmp) - - default_token = color_map.pop('') - return default_token, color_map - - -class StyleWriter(object): - - def __init__(self, code, name): - self.code = code - self.name = name.lower() - - def write_header(self, out): - out.write('# -*- coding: utf-8 -*-\n"""\n') - out.write(' %s Colorscheme\n' % self.name.title()) - out.write(' %s\n\n' % ('~' * (len(self.name) + 12))) - out.write(' Converted by %s\n' % SCRIPT_NAME) - out.write('"""\nfrom pygments.style import Style\n') - out.write('from pygments.token import Token, %s\n\n' % ', '.join(TOKEN_TYPES)) - out.write('class %sStyle(Style):\n\n' % self.name.title()) - - def write(self, out): - self.write_header(out) - default_token, tokens = find_colors(self.code) - tokens = list(tokens.items()) - tokens.sort(lambda a, b: cmp(len(a[0]), len(a[1]))) - bg_color = [x[3:] for x in default_token.split() if x.startswith('bg:')] - if bg_color: - out.write(' background_color = %r\n' % bg_color[0]) - out.write(' styles = {\n') - out.write(' %-20s%r,\n' % ('Token:', default_token)) - for token, definition in tokens: - if definition: - out.write(' %-20s%r,\n' % (token + ':', definition)) - out.write(' }') - - def __repr__(self): - out = StringIO() - self.write_style(out) - return out.getvalue() - - -def convert(filename, stream=None): - name = path.basename(filename) - if name.endswith('.vim'): - name = name[:-4] - f = file(filename) - code = f.read() - f.close() - writer = StyleWriter(code, name) - if stream is not None: - out = stream - else: - out = StringIO() - writer.write(out) - if stream is None: - return out.getvalue() - - -def main(): - if len(sys.argv) != 2 or sys.argv[1] in ('-h', '--help'): - print('Usage: %s ' % sys.argv[0]) - return 2 - if sys.argv[1] in ('-v', '--version'): - print('%s %s' % (SCRIPT_NAME, SCRIPT_VERSION)) - return - filename = sys.argv[1] - if not (path.exists(filename) and path.isfile(filename)): - print('Error: %s not found' % filename) - return 1 - convert(filename, sys.stdout) - sys.stdout.write('\n') - - -if __name__ == '__main__': - sys.exit(main() or 0) -- cgit v1.2.1