def verifyLinks(self, include, apiPath): self._console.info("Verifying links...") import re self._linkRegExp = re.compile( "\{\s*@link\s*([\w#-_\.]*)[\W\w\d\s]*?\}") self._console.indent() self._console.info("Loading class docs...") targets = [] links = [] mixinUsage = {} # Open APIdata files and get the needed information dirwalker = os.walk(apiPath) files = [] for (path, dirlist, filelist) in dirwalker: for file in filelist: if file[-5:] == ".json" and not "apiindex" in file: files.append(os.path.join(path, file)) for file in files: classDocFile = open(file) doc = json.load(classDocFile) try: fullName = doc["attributes"]["fullName"] except KeyError: fullName = "doctree" (classTargets, classLinks, classMixinUsage) = self._getDocNodes(doc, fullName) targets += classTargets links += classLinks mixinUsage.update(classMixinUsage) # Get mixin members and add them to the classes that use them newTargets = [] for clazz in mixinUsage: mixinList = mixinUsage[clazz] for mixin in mixinList: for target in targets: if mixin + "#" in target: memberName = target[target.find("#"):] newTargets.append(clazz + memberName) targets += newTargets self._console.outdent() self._console.info("Checking links...") self._console.indent() self._checkLinks(links, targets) self._console.outdent() self._console.info("Finished checking links")
def verifyLinks(self, include, apiPath): self._console.info("Verifying links...") import re self._linkRegExp = re.compile("\{\s*@link\s*([\w#-_\.]*)[\W\w\d\s]*?\}") self._console.indent() self._console.info("Loading class docs...") targets = [] links = [] mixinUsage = {} # Open APIdata files and get the needed information dirwalker = os.walk(apiPath) files = [] for (path, dirlist, filelist) in dirwalker: for file in filelist: if file[-5:] == ".json" and not "apiindex" in file: files.append(os.path.join(path,file)) for file in files: classDocFile = open(file) doc = json.load(classDocFile) try: fullName = doc["attributes"]["fullName"] except KeyError: fullName = "doctree" (classTargets,classLinks,classMixinUsage) = self._getDocNodes(doc, fullName) targets += classTargets links += classLinks mixinUsage.update(classMixinUsage) # Get mixin members and add them to the classes that use them newTargets = [] for clazz in mixinUsage: mixinList = mixinUsage[clazz] for mixin in mixinList: for target in targets: if mixin + "#" in target: memberName = target[target.find("#"):] newTargets.append(clazz + memberName) targets += newTargets self._console.outdent() self._console.info("Checking links...") self._console.indent() self._checkLinks(links,targets) self._console.outdent() self._console.info("Finished checking links")
def _get_dependencies(self): deps = {} if os.path.isfile(self._dependencies_path): deps = json.load(self._dependencies_path) return deps