def init_with_files(fmeta, fdata): meta = NSDictionary.dictionaryWithContentsOfFile_(fmeta) data = NSArray.arrayWithContentsOfFile_(fdata) return meta, data
for match in matches: if match["MatchType"] == "Match": count += 1 elif match["MatchType"] == "MatchAny": count += len(match["Matches"]) else: raise Exception("Invalid MatchType.") return count # --------------------------------------------------------------------------- if __name__ == "__main__": XPROTECTS = NSArray.arrayWithContentsOfFile_(os.path.join(sys.path[0], "XPlist.plist")) if not XPROTECTS: raise Exception("Invalid URLs property list file.") for xprotect in XPROTECTS: # print target print xprotect["name"] # print source # init meta and data if xprotect.has_key("url"): print xprotect["url"] meta, data = init_with_url(xprotect["url"])