def insertWebsite(self, url, domain):
		'''增加一个网页,标记为未访问,并对相应的domain增加其入度'''
		cur = self.conn.cursor()
		cur.execute("SELECT 1 FROM Domains WHERE domain=?", (domain,))
		result = cur.fetchone()
		if not result:
			# 未有对应domain记录, 先创建domain, 把入度设为1
			if VERBOSE:
				print 'Spot Domain:',domain
			self.insertDomain(domain, indegree=1)
			cur.execute("SELECT did FROM Domains WHERE domain=?", (domain,))
			did = cur.fetchone()[0]
		else:
			did = result[0]
			# 对应的domain记录已经存在, 对其入度+1
			cur.execute("UPDATE Domains SET outdegree=outdegree+1 WHERE domain=?", (domain,))

		cur.execute("INSERT INTO Websites VALUES (NULL,?,?,NULL,0)", (did, url,))
		# 写入到文件
		self.conn.commit()
def _donormalize(patterns, default, root, cwd, auditor, warn):
    """Convert 'kind:pat' from the patterns list to tuples with kind and
    normalized and rooted patterns and with listfiles expanded."""
    kindpats = []
    for kind, pat in [_patsplit(p, default) for p in patterns]:
        if kind in cwdrelativepatternkinds:
            pat = pathutil.canonpath(root, cwd, pat, auditor)
        elif kind in ("relglob", "path", "rootfilesin"):
            pat = util.normpath(pat)
        elif kind in ("listfile", "listfile0"):
            try:
                files = decodeutf8(util.readfile(pat))
                if kind == "listfile0":
                    files = files.split("\0")
                else:
                    files = files.splitlines()
                files = [f for f in files if f]
            except EnvironmentError:
                raise error.Abort(_("unable to read file list (%s)") % pat)
            for k, p, source in _donormalize(files, default, root, cwd, auditor, warn):
                kindpats.append((k, p, pat))
            continue
        elif kind == "include":
            try:
                fullpath = os.path.join(root, util.localpath(pat))
                includepats = readpatternfile(fullpath, warn)
                for k, p, source in _donormalize(
                    includepats, default, root, cwd, auditor, warn
                ):
                    kindpats.append((k, p, source or pat))
            except error.Abort as inst:
                raise error.Abort("%s: %s" % (pat, inst[0]))
            except IOError as inst:
                if warn:
                    warn(
                        _("skipping unreadable pattern file '%s': %s\n")
                        % (pat, inst.strerror)
                    )
            continue
        # else: re or relre - which cannot be normalized
        kindpats.append((kind, pat, ""))
    return kindpats