From 580cd62f0a4fac5dba37a8a152afaecd99e8c767 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 15 Dec 2011 20:07:48 -0500 Subject: removed old libraries - depends on openid_api now --- .../openid-php-openid-782224d/admin/phpaliases.py | 119 --------------------- 1 file changed, 119 deletions(-) delete mode 100644 models/openid-php-openid-782224d/admin/phpaliases.py (limited to 'models/openid-php-openid-782224d/admin/phpaliases.py') diff --git a/models/openid-php-openid-782224d/admin/phpaliases.py b/models/openid-php-openid-782224d/admin/phpaliases.py deleted file mode 100644 index c4ce21684..000000000 --- a/models/openid-php-openid-782224d/admin/phpaliases.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python - -"""This script searches files for functions that are just aliases in -PHP source code. This is not 100% reliable, so it should not be -automated, but it's useful to run once in a while to make sure that -all of the matches it finds are not really legitimate aliases. - -Usage: - - parse_aliases.py [PHP source code filename]... -""" - -import sys - -# Fetch this URL to get the file that is parsed into the aliases list -alias_url = 'http://www.zend.com/phpfunc/all_aliases.php' - -header_tok = ''; -footer_tok = ''; - -# Example line of the table that we parse: -# 'bzclosephp-src/ext/bz2/bz2.cfclose' - -import re - -line_re = re.compile(r''' -\A - -]+"> - -([^<>]+) - -]+">[^<>]+ - - -(?: - ]+\.php"> - ( [^<>]+ ) - -| ( [^<>]+ ) -) - - - - -\Z -''', re.VERBOSE) - -def parseString(s): - _, rest = s.split(header_tok, 1) - body, _ = rest.split(footer_tok, 1) - - lines = body.split('\n') - assert [s.strip() for s in lines[-2:]] == ['', ''] - assert lines[0].strip().startswith('|\$|)\s*\b(%s)\b' % ('|'.join(aliases.keys()))) - -def checkAliasesFile(alias_re, f): - found = [] - line_num = 1 - for line in f: - for mo in alias_re.finditer(line): - if mo.group(1): - continue - alias = mo.group(2) - found.append((line_num, alias)) - line_num += 1 - return found - -def checkAliases(alias_re, filename): - return checkAliasesFile(alias_re, file(filename, 'r')) - -def checkAliasesFiles(alias_re, filenames): - found = [] - for filename in filenames: - file_found = checkAliases(alias_re, filename) - found.extend([(filename, n, a) for (n, a) in file_found]) - return found - -def dumpResults(aliases, found, out=sys.stdout): - for filename, n, a in found: - print >>out, "%s:%d %s -> %s" % (filename, n, a, aliases[a]) - -def main(alias_file, *filenames): - aliases = parseFileName(alias_file) - alias_re = getAliasRE(aliases) - found = checkAliasesFiles(alias_re, filenames) - dumpResults(aliases, found) - return found - -if __name__ == '__main__': - found = main(*sys.argv[1:]) - if found: - sys.exit(1) -- cgit v1.2.3