PageSourceSearch

https://wild-cards.net/wc/wp-content/plugins/syntaxhighlighter/syn…/scripts/shBrushPython.js?ver=2.1.364

js wild-cards.net collected 2026-10-03 22:10:45 UTC 2,970 bytes, 66 lines download raw bytes

1/**
2 * SyntaxHighlighter
3 * http://alexgorbatchev.com/
4 *
5 * SyntaxHighlighter is donationware. If you are using it, please donate.
6 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7 *
8 * @version
9 * 2.1.364 (October 15 2009)
10 * 
11 * @copyright
12 * Copyright (C) 2004-2009 Alex Gorbatchev.
13 *
14 * @license
15 * This file is part of SyntaxHighlighter.
16 * 
17 * SyntaxHighlighter is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Lesser General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 * 
22 * SyntaxHighlighter is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 * GNU General Public License for more details.
26 * 
27 * You should have received a copy of the GNU General Public License
28 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/copyleft/lesser.html>.
29 */
30SyntaxHighlighter.brushes.Python = function()
31{
32	// Contributed by Gheorghe Milas and Ahmad Sherif
33	
34	var keywords =  'and assert break class continue def del elif else ' +
35					'except exec finally for from global if import in is ' +
36					'lambda not or pass print raise return try yield while';
37
38	var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
39				'chr classmethod cmp coerce compile complex delattr dict dir ' +
40				'divmod enumerate eval execfile file filter float format frozenset ' +
41				'getattr globals hasattr hash help hex id input int intern ' +
42				'isinstance issubclass iter len list locals long map max min next ' +
43				'object oct open ord pow print property range raw_input reduce ' +
44				'reload repr reversed round set setattr slice sorted staticmethod ' +
45				'str sum super tuple type type unichr unicode vars xrange zip';
46
47	var special =  'None True False self cls class_';
48
49	this.regexList = [
50			{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
51			{ regex: /^\s*@\w+/gm, 										css: 'decorator' },
52			{ regex: /(['\"]{3})([^\1])*?\1/gm, 						css: 'comments' },
53			{ regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, 					css: 'string' },
54			{ regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, 				css: 'string' },
55			{ regex: /\+|\-|\*|\/|\%|=|==/gm, 							css: 'keyword' },
56			{ regex: /\b\d+\.?\w*/g, 									css: 'value' },
57			{ regex: new RegExp(this.getKeywords(funcs), 'gmi'),		css: 'functions' },
58			{ regex: new RegExp(this.getKeywords(keywords), 'gm'), 		css: 'keyword' },
59			{ regex: new RegExp(this.getKeywords(special), 'gm'), 		css: 'color1' }
60			];
61			
62	this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
63};
64
65SyntaxHighlighter.brushes.Python.prototype  = new SyntaxHighlighter.Highlighter();
66SyntaxHighlighter.brushes.Python.aliases    = ['py', 'python'];

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.