' + header2domain + ''
#sports: « Sports |
# RETURN TO MAIN - VERSION TWO
kb2correct[5] = '«' + header2domain.upper() + ' Sensing' + ' | '
#lex: « LEX Sensing |
# RETURN TO CHINA
kb2correct[6] = '«' + header2domain + 'Sensing in China | '
#uas: « UAS Sensing in China |
# RETURN TO USA
kb2correct[7] = '«' + header2domain + 'Sensing | '
#uas: « UAS Sensing |
# -------------------------------------------------------------------------------------------------
# TO-BE-REPLACED IN INPUT
# -------------------------------------------------------------------------------------------------
# HTML version
kb2replace[1] = '' + header2domain + ''
#sports: « Sports |
# RETURN TO MAIN - VERSION TWO
kb2replace[5] = '«' + header2domain.upper() + ' Sensing' + ' | '
#lex: '« LEX Sensing | '
# RETURN TO CHINA
kb2replace[6] = '«' + header2domain + 'Sensing in China | '
#uas: « UAS Sensing in China |
# RETURN TO USA
kb2replace[7] = '«' + header2domain + 'Sensing | '
#uas: « UAS Sensing |
# -------------------------------------------------------------------------------------------------
# EXAMPLES OF UPGRADE SETTINGS
# -------------------------------------------------------------------------------------------------
PickleKB4Xi = {
'a': Pickle2a4Xi,
'b': Pickle2b4Xi,
'c': Pickle2c4Xi,
'd': Pickle2d4Xi,
'e': Pickle2e4Xi,
'f': Pickle2f4Xi,
'g': Pickle2g4Xi,
'h': Pickle2h4Xi,
'i': Pickle2i4Xi,
'j': Pickle2j4Xi,
'k': Pickle2k4Xi,
'l': Pickle2l4Xi,
'm': Pickle2m4Xi,
'n': Pickle2n4Xi,
'o': Pickle2o4Xi,
'p': Pickle2p4Xi,
'q': Pickle2q4Xi,
'r': Pickle2r4Xi,
's': Pickle2s4Xi,
't': Pickle2t4Xi,
'u': Pickle2u4Xi,
'v': Pickle2v4Xi,
'w': Pickle2w4Xi,
'x': Pickle2x4Xi,
'y': Pickle2y4Xi,
'z': Pickle2z4Xi,
'_': Pickle2_4Xi}
#"
#"/>
# -------------------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------------------------
def set2trace4fecth():
global t2xi
global trace_object_count
global PickleKB4Xi
# print("(Step 00A/33) OF SET2TRACE4FECTH - STARTING SETTING TRACE BASED ON TRACE SETTINGS IN MODULES PICKLE2x4XI.PY (x=a,b...) ", time4xi())
# print("(Step 00B/33) OF SET2TRACE4FECTH - USING T2XI: ", t2xi)
#
# ---------------------------------------------------------------------------------------------
# A, B .... _
# ---------------------------------------------------------------------------------------------
keys2pickledb = sorted(PickleKB4Xi.keys())
for key2pickledb in keys2pickledb:
# -----------------------------------------------------------------------------------------
# LETTERS
# -----------------------------------------------------------------------------------------
# print('=' *33)
# print("STARTING LETTER : ", key2pickledb)
# print('=' *33)
dictionary2pickle = PickleKB4Xi[key2pickledb]
# print("STARTING DICTIONARY: ", dictionary2pickle)
# print('~' *33)
#
keys2dictionary = sorted(dictionary2pickle.keys())
# -----------------------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------------------
for key2dictionary in keys2dictionary:
# -------------------------------------------------------------------------------------
# DICTIONARY
# -------------------------------------------------------------------------------------
# print('~' *33)
object2pickle = key2dictionary
# print("STARTING OBJECT: ", object2pickle)
# print('~' *33)
# pickle4xi(object2pickle)
# print('~' *33)
# print("PICKLED object: ", object2pickle)
# PICKLED object: _C4Xi,
# ---------------------------------------------------------------------------------
# Mark those with NACK4XI to be traced !
# ---------------------------------------------------------------------------------
if dictionary2pickle[key2dictionary] == 'NACK4XI':
set_param2xi = True
key_param = object2pickle
t2xi.set_print_permission(key_param, set_param2xi)
# print("(Step 002A/33) OF SET2TRACE4FECTH - MARKED TO BE TRACED OBJECT: ", object2pickle)
#
else:
pass
# ---------------------------------------------------------------------------------
# END OF DICTIONARY
# ---------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------------
# END OF LETTERS
# -----------------------------------------------------------------------------------------
# print('~' *33)
# print("COMPLETED DICTIONARY: ", dictionary2pickle)
# print('~' *33)
# -----------------------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------------------
# print('=' *33)
# print("COMPLETED LETTER : ", key2pickledb)
# print('=' *33)
# ---------------------------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------------------------
print('=' *33)
print("(Step 0033/33) OF SET2TRACE4FECTH - COMPLETED SETTING TRACE BASED ON NACK4XI/ACK4XI SETTINGS IN MODULES PICKLE2x4XI.PY (x=a,b...) ", time4xi())
print('=' *33)
#
# -------------------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------------------
def deny2trace4fetch():
global t2xi
global trace_object_count
global PickleKB4Xi
print("(Step 001A/33) of DENY2TRACE4FECTH: STARTING DENYING TRACE IN MODULES PICKLE2x4XI.PY (x=a,b...) ", time4xi())
print("(Step 001B/33) OF DENY2TRACE4FECTH - USING T2XI: ", t2xi)
#
# ---------------------------------------------------------------------------------------------
# A, B .... _
# ---------------------------------------------------------------------------------------------
keys2pickledb = sorted(PickleKB4Xi.keys())
for key2pickledb in keys2pickledb:
# -----------------------------------------------------------------------------------------
# LETTERS
# -----------------------------------------------------------------------------------------
# print("(Step 001C/33) OF DENY2TRACE4FECTH - STARTING LETTER : ", key2pickledb)
dictionary2pickle = PickleKB4Xi[key2pickledb]
# print("(Step 001D/33) OF DENY2TRACE4FECTH - STARTING DICTIONARY: ", dictionary2pickle)
keys2dictionary = sorted(dictionary2pickle.keys())
# -----------------------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------------------
for key2dictionary in keys2dictionary:
# -------------------------------------------------------------------------------------
# DICTIONARY
object2pickle = key2dictionary
# print("(Step 001E/33) OF DENY2TRACE4FECTH - STARTING OBJECT: ", object2pickle)
# pickle4xi(object2pickle)
# print("STEROOT4XI PICKLED object: ", object2pickle)
# PICKLED object: _C4Xi,
# ---------------------------------------------------------------------------------
# ACK4XI = tested .i.e. NOT to be traced!
# ---------------------------------------------------------------------------------
set_param2xi = 'ACK4XI'
key_param = object2pickle
t2xi.set_print_permission(key_param, set_param2xi)
# print("(Step 001F/33) OF DENY2TRACE4FECTH - MARKED TESTED AND NOT to be traced: ", object2pickle)
dictionary2pickle[key2dictionary] = 'ACK4XI'
# ---------------------------------------------------------------------------------
# END OF DICTIONARY
# ---------------------------------------------------------------------------------
# print('~' *33)
# print("(Step 001Z/33) OF DENY2TRACE4FECTH *** FAILED - ERROR IN PICKLING OBJECT - NOT TO BE TRACED: ", object2pickle)
# print('~' *33)
# -----------------------------------------------------------------------------------------
# END OF LETTERS
# -----------------------------------------------------------------------------------------
# print("(Step 001G/33) OF DENY2TRACE4FECTH - COMPLETED DICTIONARY: ", dictionary2pickle)
#
# -----------------------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------------------
# print("(Step 002F/33) OF DENY2TRACE4FECTH - COMPLETED LETTER : ", key2pickledb)
# _, a ... z
print("(Step 0033/33) OF SET2TRACE4FECTH - COMPLETED DENYING TRACE IN MODULES PICKLE2x4XI.PY (x=a,b...) ", time4xi())
#
# -------------------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------------------
def tailor2trace4xi():
global trace_object_count
global PickleKB4Xi
global t2xi
print("(Step 001A/33) OF TAILOR2TRACE4FECTH - USING T2XI: ", t2xi)
#
# ---------------------------------------------------------------------------------------------
# Settings to tailor trace
# ---------------------------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------------------------
# PROCESS KB4Tailoring
# ---------------------------------------------------------------------------------------------
keys2tailor = sorted(KB4Tailoring.keys())
for key2tailor in keys2tailor:
# ---------------------------------------------------------------------------------
# NACK4XI = NOT TESTED .I.E. TO BE TRACED!
# ---------------------------------------------------------------------------------
set_param2xi = 'NACK4XI'
key_param = key2tailor
t2xi.set_print_permission(key_param, set_param2xi)
print("(Step 002A/33) OF TAILOR_TRACE4XI - MARKED TO BE TESTED: ", key2tailor)
# Pipe4Xi, Process4Xi, Queue4Xi, get2sense4xi
# -----------------------------------------------------------------------------------------
# EOF KEYS
# -----------------------------------------------------------------------------------------
print("(Step 0033/33) OF TAILOR_TRACE4XI - COMPLETED TAILORING: ", time4xi())
#
#
# -------------------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------------------
def print_trace4xi(t2xi):
class2print = "get2sense4xi"
method2print = "get2sense4xi"
message2print = "{passed" + "; t2xi-passed-to-print-trace4xi: " + str(t2xi) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
#
# -------------------------------------------------------------------------------------------------
# SENSE
# -------------------------------------------------------------------------------------------------
context2sense = {
'file_path4xi': '..//..//..//..//web//xml//sense-get2sense.xml',
'name_space4xi': ' xmlns="https://www.yourdragonxi.org/studio4xi/owl/studio4xi.owl#"\n',
'xml_base4xi': ' xml:base="https://www.yourdragonxi.org/web/lib/owl/studio4xi.owl">\n',
'ontology_about4xi': ' \n',
'ontology_comment4xi': ' Classes, methods and messages with context.\n',
'class0_id4xi': ' \n',
'class0_comment4xi': ' Sensing get2sense4xi.\n',
'object_property_rdf4xi': ' \n',
'object_property_comment4xi': ' get2sense4xi sensed.\n',
'debug4xi': True}
xml_trace_sense4xi(t2xi, context2sense)
# -------------------------------------------------------------------------------------------------
# REASON
# -------------------------------------------------------------------------------------------------
context2reason = {
'file_path4xi': '..//..//..//..//web//xml//reason-get2sense.xml',
'name_space4xi': ' xmlns="https://www.yourdragonxi.org/studio4xi/owl/studio4xi.owl#"\n',
'xml_base4xi': ' xml:base="https://www.yourdragonxi.org/web/lib/owl/studio4xi.owl">\n',
'ontology_about4xi': ' \n',
'ontology_comment4xi': ' Operations\n',
'operation_comment4xi': ' Operations for get2sense4xi.\n',
'class0_id4xi': ' \n',
'class0_comment4xi': ' Operations with context.\n',
'object_property_rdf4xi': ' \n',
'object_property_comment4xi': ' reason\n',
'debug4xi': True}
xml_trace_reason4xi(t2xi, context2reason)
# -------------------------------------------------------------------------------------------------
# ACE
# -------------------------------------------------------------------------------------------------
context2ace = {
'file_path4xi': '..//..//..//..//web//xml//ace-get2sense.xml',
'name_space4xi': ' xmlns="https://www.yourdragonxi.org/studio4xi/owl/studio4xi.owl#"\n',
'xml_base4xi': ' xml:base="https://www.yourdragonxi.org/web/lib/owl/studio4xi.owl">\n',
'ontology_about4xi': ' \n',
'ontology_comment4xi': ' Objects and values for get2sense4xi.\n',
'class0_id4xi': ' \n',
'class0_comment4xi': ' Objects and values of get2sense4xi.\n',
'object_property_rdf4xi': ' \n',
'object_property_comment4xi': ' 000000\n',
'debug4xi': True}
xml_trace_ace4xi(t2xi, context2ace)
# -------------------------------------------------------------------------------------------------
# end of print_trace4xi
# -------------------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------------------
def get2sense4xi(file2explore):
global count2skipped
global count2found
global count2total
global count2upgrade
global kb2fetch # knowledgebase for fetching
global kb2log # knowledgebase for log
global kb2correct # knowledgebase for correcting content
global kb2replace # knowledgebase for replacing content
global path2read4xi # path for input files
global path2temp4xi # path for output files
global profile2fetch # extension for files
global t2xi
global trace_object_count
class2print = "get2sense4xi"
method2print = "get2sense4xi"
message2print = "{(Step 0A/33) got" + "; file2explore-got-by-get2sense4xi: " + str(file2explore) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//tv//us\en\en-us-ugs-xi2.html
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html
# ---------------------------------------------------------------------------------------------
# SPLIT FILE NAME WITH PATH AND EXTENSION TO TWO PIECES
# ---------------------------------------------------------------------------------------------
name2file=os.path.splitext(file2explore)
if name2file[1] == profile2fetch:
# -----------------------------------------------------------------------------------------
# (Step 1/33) OF GET2SENSE4XI - PROPER FILE TYPE
# -----------------------------------------------------------------------------------------
message2print = "{(Step 1A/33) analyzing" + "; file2explore-analyzing-by-get2sense4xi: " + str(file2explore) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us\en\en-us-ugs-xi2.html
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html
path2input = name2file[0] + profile2fetch
message2print = "{(Step 1B/33) set" + "; path2input-set-by-get2sense4xi to: " + str(path2input) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us\en\en-us-ugs-xi2.html
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html
# -----------------------------------------------------------------------------------------
# (Step 2/33) OF GET2SENSE4XI - CHECKING WHETHER FILE MUST BE FETCHED
# -----------------------------------------------------------------------------------------
message2print = "{(Step 2A/33) analyzing" + "; path2input-analyzing-by-get2sense4xi: " + str(path2input) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us\en\en-us-ugs-xi2.html
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html
keys2fetch = kb2fetch.keys()
ack2match = False
for key2fecth in keys2fetch:
string2search = kb2fetch[key2fecth]
index2search=str.find(path2input,string2search)
if index2search == -1:
ack2match = True
else:
pass
if ack2match is True:
message2print = "{(Step 2B/33) decided" + "; file-to-read-decided-by-get2sense4xi: " + str(path2input) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us\en\en-us-ugs-xi2.html
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html
max2count = 33
count2try = 0
string2search = "/"
# message2print = "{(Step 2C/33) initialized" + "; string2search-initialized-by-get2sense4xi to: " + str(string2search) + "; time: " + time4xi() + "}"
# print4xi(class2print, method2print, message2print)
# /
source2save = path2input
while 1:
index2search=str.find(source2save,string2search)
if index2search == -1:
if count2try == 0:
source2save = "dummy.html"
message2print = "{(Step 2Z1/33) hit" + "; source2save-set-by-get2sense4xi: " + str(source2save) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
#
break
else:
#
string2search = "\\"
else:
source2save = source2save[index2search+1:]
# message2print = "{(Step 2E/33) set" + "; source2save-set-by-get2sense4xi to: " + str(source2save) + "; time: " + time4xi() + "}"
# print4xi(class2print, method2print, message2print)
# /DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html ...
# index-ugs-xi2.html
# /us\en\en-us-ugs-xi2.html ... en-us-ugs-xi2.html
count2try = count2try + 1
if count2try > max2count:
# message2print = "{(Step 2Z2/33) hit" + "; count2try-hit-by-get2sense4xi: " + str(count2try) + "; time: " + time4xi() + "}"
# print4xi(class2print, method2print, message2print)
# 34
message2print = "{(Step 2Z3/33) got" + "; source2save-got-by-get2sense4xi: " + str(source2save) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# index-ugs-xi2.html
# en-us-ugs-xi2.html
break
path2write4file = path2temp4xi + source2save
message2print = "{(Step 2F/33) set" + "; path2write4file-set-by-get2sense4xi to: " + str(path2write4file) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//TempTokaTera//sense//index-ugs-xi2.html
# ROOT4XI//TempTokaTera//sense//en-us-ugs-xi2.html
kb2log[source2save] = path2input
count2total = count2total + 1
# -----------------------------------------------------------------------------------------
# (Step 3/33) OF GET2SENSE4XI - OPEN FOR READ INPUT LINES
# -----------------------------------------------------------------------------------------
file2input = open(path2input,'r')
message2print = "{(Step 3A/33) opened" + "; file2input-opened-by-get2sense4xi: " + str(file2input) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# <_io.TextIOWrapper name='ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html' mode='r' encoding='cp1252'>
# -----------------------------------------------------------------------------------------
# (Step 4/33) OF GET2SENSE4XI - OPEN OUTPUT
# -----------------------------------------------------------------------------------------
file2output = open(path2write4file,'w')
message2print = "{(Step 3B/33) opened" + "; file2output-opened-by-get2sense4xi: " + str(file2output) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//index-ugs-xi2.html' mode='w' encoding='cp1252'>
while 1:
# -------------------------------------------------------------------------------------
# (Step 5/33) OF GET2SENSE4XI - PROCESS FILE
# -------------------------------------------------------------------------------------
try:
line2process = file2input.readline()
except:
message2print = "{(Step 7Z/33) failed" + "; line2process-failed-by-get2sense4xi: " + str(line2process) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
#
line2process = '
' + '\n'
if not line2process:
# ---------------------------------------------------------------------------------
# (Step 30/33) OF GET2SENSE4XI - ALL LINES READ, FINISH
# ---------------------------------------------------------------------------------
break
else:
# ---------------------------------------------------------------------------------
# (Step 7/33) OF GET2SENSE4XI - PROCESS LINE
# ---------------------------------------------------------------------------------
# correct content due to for example older HTML-version, CMS-type object reference
keys2correct = kb2correct.keys()
for key2correct in sorted(keys2correct):
index2search=str.find(line2process,kb2correct[key2correct])
if index2search == -1:
pass
else:
line2process = line2process.replace(kb2correct[key2correct],kb2replace[key2correct])
# message2print = "{(Step 7/33) upgraded" + "; line2process-upgraded-by-get2sense4xi: " + str(line2process) + "; time: " + time4xi() + "}"
# print4xi(class2print, method2print, message2print)
# ---------------------------------------------------------------------------------
# (Step 29/33) OF GET2SENSE4XI - WRITE PROCESSED LINE
# ---------------------------------------------------------------------------------
line2write = line2process
file2output.write(line2write)
# -----------------------------------------------------------------------------------------
# (Step 31/33) OF GET2SENSE4XI - CLOSE INPUT
# -----------------------------------------------------------------------------------------
file2input.close()
message2print = "{(Step 31A/33) closed" + "; file2input-closed-by-get2sense4xi: " + str(file2input) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# <_io.TextIOWrapper name='ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html' mode='r' encoding='cp1252'>
# -----------------------------------------------------------------------------------------
# (Step 32/33) OF GET2SENSE4XI - CLOSE OUTPUT
# -----------------------------------------------------------------------------------------
file2output.close()
message2print = "{(Step 31B/33) closed" + "; file2output-closed-by-get2sense4xi: " + str(file2output) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//index-ugs-xi2.html' mode='w' encoding='cp1252'>
else:
message2print = "{(Step 1E/33) skipped" + "; path2input-skipped-by-get2sense4xi: " + str(path2input) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index.html <-- only for server
count2skipped = count2skipped + 1
count2total = count2total + 1
else:
message2print = "{(Step 1F/33) skipped" + "; name2file-skipped-by-get2sense4xi: " + str(name2file) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
# ('ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//dir2x', '.bat')
extension2skip = name2file[1]
message2print = "{(Step 1G/33) skipped" + "; extension-skipped-by-get2sense4xi: " + str(extension2skip[1:]) + "; time: " + time4xi() + "}"
print4xi(class2print, method2print, message2print)
#
count2skipped = count2skipped + 1
count2total = count2total + 1
#
# =================================================================================================
#
# =================================================================================================
class DirectoryWalker:
# ---------------------------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------------------------
def __init__(self, directory):
self.stack = [directory]
self.files = []
self.index = 0
#
# ---------------------------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------------------------
def __getitem__(self, index):
while 1:
# -------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------
try:
# ---------------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------------
file = self.files[self.index]
self.index = self.index + 1
except IndexError:
# ---------------------------------------------------------------------------------
# pop next directory from stack
# ---------------------------------------------------------------------------------
self.directory = self.stack.pop()
self.files = os.listdir(self.directory)
self.index = 0
else:
# ---------------------------------------------------------------------------------
# got a filename
# ---------------------------------------------------------------------------------
fullname = os.path.join(self.directory, file)
if os.path.isdir(fullname) and not os.path.islink(fullname):
self.stack.append(fullname)
return fullname
#
#
# -------------------------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------------------------
def main():
global count2skipped
global count2found
global count2total
global count2upgrade
global kb2fetch # knowledgebase for fetching
global kb2log # knowledgebase for log
global kb2correct # knowledgebase for correcting content
global kb2replace # knowledgebase for replacing content
global kb2log
global path2read4xi
global path2temp4xi
global profile2fetch
global t2xi
global trace_object_count
# -------------------------------------------------------------------------------------------------
# INITIALIZE
# -------------------------------------------------------------------------------------------------
t2xi = Print4Xi()
print("(Step 1A/33) OF MAIN GET2SENSE4XI - SET T2XI TO: ", t2xi)
#
count2skipped = 0
count2found = 0
count2total = 0
set2trace4fecth() # trace all classes and functions in the system
deny2trace4fetch() # deny trace for all classes and functions in the system
tailor2trace4xi() # tailor trace for this test
pipe2fetch = Pipe4Xi()
queue2fetch = Queue4Xi()
# ---------------------------------------------------------------------------------------------
# START
# ---------------------------------------------------------------------------------------------
print('=' *70)
print("(Step 2A/33) OF MAIN GET2SENSE4XI - VERSION 7.21 FOR ", path2read4xi, " WITH PROFILE: ", profile2fetch, " STARTED ", time4xi())
# VERSION 7.21 FOR ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs// WITH PROFILE: .html STARTED 07:13:37 01/06/14 Pacific Standard Time
path2read4xi = VersionKB4Xi['folder2view4sense']
print ('(Step 2B/33) OF MAIN GET2SENSE4XI - PATH2READ4XI: ', path2read4xi)
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//
print('=' *70)
pipe2fetch = Pipe4Xi()
print("(Step 2C/33) OF MAIN GET2SENSE4XI - PIPE2FETCH ", pipe2fetch)
# (, )
queue2fetch = Queue4Xi()
print("(Step 2D/33) OF MAIN GET2SENSE4XI - QUEUE2FETCH ", queue2fetch)
#
for file2walk in DirectoryWalker(path2read4xi):
# -----------------------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------------------
if os.path.isdir(file2walk):
print ("(Step 2E/33) OF MAIN GET2SENSE4XI - DIRECTORY: " + file2walk + '\n')
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//br
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//jp
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//mil
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//org
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//se
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//uk
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//xx
if os.path.isfile(file2walk):
ack2sense = True
keys2fetch = kb2fetch.keys()
for key2fecth in keys2fetch:
string2search = kb2fetch[key2fecth]
# print ("(Step 2F/33) OF MAIN GET2SENSE4XI - STRING2SEARCH: " + string2search + '\n')
#
index2search=str.find(file2walk,string2search)
if index2search == -1:
pass
else:
ack2sense = False
if ack2sense is True:
print ("(Step 2G/33) OF MAIN GET2SENSE4XI - DECIDED TO EXAMINE FILE: " + file2walk + '\n')
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//dir2x.bat <-- folder is OK, file rejected late on
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html <-- folder and file are OK
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us\en\en-us-ugs-xi2.html <-- OK
get2sense4xi(file2walk)
else:
print ("(Step 2H/33) OF MAIN GET2SENSE4XI - SKIPPED FILE: " + file2walk + '\n')
# ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index.html <-- just for server
#
# ---------------------------------------------------------------------------------------------
# END
# ---------------------------------------------------------------------------------------------
print('=' *75)
print("(Step 3A/33) OF MAIN GET2SENSE4XI - VERSION 8.12 FOR ", path2read4xi, " WITH PROFILE: ", profile2fetch, " COMPLETED ", time4xi())
# -------------------------------------------------------------------------------------------
# STATISTICS
# -------------------------------------------------------------------------------------------
print ('(Step 4A/33) OF MAIN GET2SENSE4XI - FOUND: ', count2found)
print ('(Step 4B/33) OF MAIN GET2SENSE4XI - SKIPPED: ', count2skipped)
print ('(Step 4C/33) OF MAIN GET2SENSE4XI - TOTAL: ', count2total)
print ('(Step 4D/33) OF MAIN GET2SENSE4XI - COUNT2UPGRADE: ', count2upgrade)
test2total = count2found + count2skipped
if test2total == count2total:
pass
else:
print ('(Step 4Z/33) OF MAIN GET2SENSE4XI *** FAILED: FOUND + SKIPPED: ', test2total, " .NE. TOTAL: ", count2total, " ***")
print ('(Step 4D/33) OF MAIN GET2SENSE4XI - KB2LOG: ')
print('=' *75)
keys2log = kb2log.keys()
for key2log in sorted(keys2log):
print(key2log, kb2log[key2log])
# en-br-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//br\en\en-br-ugs-xi2.html
# en-ca-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//ca\en\en-ca-ugs-xi2.html
# en-de-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//de\en\en-de-ugs-xi2.html
# en-fi-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//fi\en\en-fi-ugs-xi2.html
# en-jp-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//jp\en\en-jp-ugs-xi2.html
# en-mil-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//mil\en\en-mil-ugs-xi2.html
# en-org-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//org\en\en-org-ugs-xi2.html
# en-uk-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//uk\en\en-uk-ugs-xi2.html
# en-us-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//us\en\en-us-ugs-xi2.html
# index-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//index-ugs-xi2.html
# sv-se-ugs-xi2.html ROOT4XI//DRAGONXI//PC4Xi//YoDragonXiOrg//WebSite//sense//ugs//se\sv\sv-se-ugs-xi2.html
print('=' *75)
# -------------------------------------------------------------------------------------------
# (Step 5/33) CREATE GET2ALL.BAT
# -------------------------------------------------------------------------------------------
path2write4file = path2temp4xi + "get2all.bat"
print('(Step 5A/33) OF MAIN GET2SENSE4XI - PATH2WRITE4FILE: ', path2write4file)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//get2all.bat' mode='w' encoding='cp1252'>
file2output = open(path2write4file,'w')
print('(Step 5A/33) OF MAIN GET2SENSE4XI - OPENED FILE2OUTPUT: ', file2output)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//get2all.bat' mode='w' encoding='cp1252'>
kb2get = {}
keys2log = kb2log.keys()
for key2log in sorted(keys2log):
kb2get[key2log] = kb2log[key2log].replace("//","\\")
keys2get = kb2get.keys()
for key2get in sorted(keys2get):
line2write = "copy " + kb2get[key2get] + " /y" + "\n"
file2output.write(line2write)
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\br\en\en-br-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\ca\en\en-ca-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\de\en\en-de-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\fi\en\en-fi-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\jp\en\en-jp-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\mil\en\en-mil-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\org\en\en-org-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\uk\en\en-uk-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\us\en\en-us-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\index-ugs-xi2.html /y
# copy E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\se\sv\sv-se-ugs-xi2.html /y
file2output.close()
print('(Step 5A/33) OF MAIN GET2SENSE4XI - CLOSED FILE2OUTPUT: ', file2output)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//get2all.bat' mode='w' encoding='cp1252'>
# -------------------------------------------------------------------------------------------
# (Step 6/33) CREATE PUT2ALL.BAT
# -------------------------------------------------------------------------------------------
path2write4file = path2temp4xi + "put2all.bat"
print('(Step 6A/33) OF MAIN PUT2SENSE4XI - PATH2WRITE4FILE: ', path2write4file)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//put2all.bat' mode='w' encoding='cp1252'>
file2output = open(path2write4file,'w')
print('(Step 6A/33) OF MAIN PUT2SENSE4XI - OPENED FILE2OUTPUT: ', file2output)
# <_io.TextIOWrapper name='ROOT4XI//TempTokaTera//sense//put2all.bat' mode='w' encoding='cp1252'>
kb2put = {}
keys2log = kb2log.keys()
for key2log in sorted(keys2log):
kb2put[key2log] = kb2log[key2log].replace("//","\\")
keys2put = kb2put.keys()
for key2put in sorted(keys2put):
line2write = "copy " + key2put + " " + kb2put[key2put] + " /y" + "\n"
file2output.write(line2write)
# copy en-br-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\br\en\en-br-ugs-xi2.html /y
# copy en-ca-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\ca\en\en-ca-ugs-xi2.html /y
# copy en-de-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\de\en\en-de-ugs-xi2.html /y
# copy en-fi-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\fi\en\en-fi-ugs-xi2.html /y
# copy en-jp-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\jp\en\en-jp-ugs-xi2.html /y
# copy en-mil-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\mil\en\en-mil-ugs-xi2.html /y
# copy en-org-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\org\en\en-org-ugs-xi2.html /y
# copy en-uk-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\uk\en\en-uk-ugs-xi2.html /y
# copy en-us-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\us\en\en-us-ugs-xi2.html /y
# copy index-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\index-ugs-xi2.html /y
# copy sv-se-ugs-xi2.html E:\DRAGONXI\PC4Xi\YoDragonXiOrg\WebSite\sense\ugs\se\sv\sv-se-ugs-xi2.html /y
file2output.close()
print('(Step 6A/33) OF MAIN PUT2SENSE4XI - CLOSED FILE2OUTPUT: ', file2output)
#
# ---------------------------------------------------------------------------------------------
# Print Trace
# ---------------------------------------------------------------------------------------------
print ('(Step 33A/33) OF MAIN GET2SENSE4XI - PRINTING TRACE WITH T2XI', t2xi)
#
print_trace4xi(t2xi)
print ('(Step 33B/33) OF MAIN GET2SENSE4XI - PRINTED TRACE WITH T2XI', t2xi)
#
# -------------------------------------------------------------------------------------------------
if __name__ == '__main__':
main()
#