Coverage of index class 100%
This commit is contained in:
+10
-11
@@ -29,8 +29,7 @@ import nw
|
||||
import logging
|
||||
import json
|
||||
import os
|
||||
|
||||
from time import time
|
||||
import time
|
||||
|
||||
from nw.constants import (
|
||||
nwFiles, nwKeyWords, nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||
@@ -177,7 +176,7 @@ class NWIndex():
|
||||
if "textCounts" in theData.keys():
|
||||
self.textCounts = theData["textCounts"]
|
||||
|
||||
nowTime = round(time())
|
||||
nowTime = round(time.time())
|
||||
self.timeNovel = nowTime
|
||||
self.timeNote = nowTime
|
||||
self.timeIndex = nowTime
|
||||
@@ -305,7 +304,7 @@ class NWIndex():
|
||||
self.refIndex[tHandle] = {}
|
||||
self.refIndex[tHandle]["T000000"] = {
|
||||
"tags" : [],
|
||||
"updated" : round(time()),
|
||||
"updated" : round(time.time()),
|
||||
}
|
||||
if itemLayout == nwItemLayout.NOTE:
|
||||
self.noteIndex[tHandle] = {}
|
||||
@@ -360,7 +359,7 @@ class NWIndex():
|
||||
self._indexWordCounts(tHandle, isNovel, lastText, nTitle)
|
||||
|
||||
# Update timestamps for index changes
|
||||
nowTime = round(time())
|
||||
nowTime = round(time.time())
|
||||
self.timeIndex = nowTime
|
||||
if isNovel:
|
||||
self.timeNovel = nowTime
|
||||
@@ -395,7 +394,7 @@ class NWIndex():
|
||||
sTitle = "T%06d" % nLine
|
||||
self.refIndex[tHandle][sTitle] = {
|
||||
"tags" : [],
|
||||
"updated" : round(time()),
|
||||
"updated" : round(time.time()),
|
||||
}
|
||||
theData = {
|
||||
"level" : hDepth,
|
||||
@@ -405,7 +404,7 @@ class NWIndex():
|
||||
"cCount" : 0,
|
||||
"wCount" : 0,
|
||||
"pCount" : 0,
|
||||
"updated" : round(time()),
|
||||
"updated" : round(time.time()),
|
||||
}
|
||||
|
||||
if hText != "":
|
||||
@@ -429,14 +428,14 @@ class NWIndex():
|
||||
self.novelIndex[tHandle][sTitle]["cCount"] = cC
|
||||
self.novelIndex[tHandle][sTitle]["wCount"] = wC
|
||||
self.novelIndex[tHandle][sTitle]["pCount"] = pC
|
||||
self.novelIndex[tHandle][sTitle]["updated"] = round(time())
|
||||
self.novelIndex[tHandle][sTitle]["updated"] = round(time.time())
|
||||
else:
|
||||
if tHandle in self.noteIndex:
|
||||
if sTitle in self.noteIndex[tHandle]:
|
||||
self.noteIndex[tHandle][sTitle]["cCount"] = cC
|
||||
self.noteIndex[tHandle][sTitle]["wCount"] = wC
|
||||
self.noteIndex[tHandle][sTitle]["pCount"] = pC
|
||||
self.noteIndex[tHandle][sTitle]["updated"] = round(time())
|
||||
self.noteIndex[tHandle][sTitle]["updated"] = round(time.time())
|
||||
return
|
||||
|
||||
def _indexSynopsis(self, tHandle, isNovel, theText, nTitle):
|
||||
@@ -447,12 +446,12 @@ class NWIndex():
|
||||
if tHandle in self.novelIndex:
|
||||
if sTitle in self.novelIndex[tHandle]:
|
||||
self.novelIndex[tHandle][sTitle]["synopsis"] = theText
|
||||
self.novelIndex[tHandle][sTitle]["updated"] = round(time())
|
||||
self.novelIndex[tHandle][sTitle]["updated"] = round(time.time())
|
||||
else:
|
||||
if tHandle in self.noteIndex:
|
||||
if sTitle in self.noteIndex[tHandle]:
|
||||
self.noteIndex[tHandle][sTitle]["synopsis"] = theText
|
||||
self.noteIndex[tHandle][sTitle]["updated"] = round(time())
|
||||
self.noteIndex[tHandle][sTitle]["updated"] = round(time.time())
|
||||
return
|
||||
|
||||
def _indexNoteRef(self, tHandle, aLine, nLine, nTitle):
|
||||
|
||||
Reference in New Issue
Block a user