338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
#
def get_data(fn, decode=False, gz=False, file_base="config"):
try:
bin = pkgutil.get_data(file_base, fn)
if gz:
bin = gzip_decode(bin)
if decode:
return bin.decode("utf-8")
else:
return str(bin)
except:
pass
# Search through ./channels/ and get module basenames.
|
|
|
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
#
def get_data(fn, decode=False, gz=False, file_base="config"):
try:
bin = pkgutil.get_data(file_base, fn)
if gz:
bin = gzip_decode(bin)
if decode:
return bin.decode("utf-8", errors='ignore')
else:
return str(bin)
except:
pass
# Search through ./channels/ and get module basenames.
|
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
intfn = add + "/" + intfn
if len(fn) >= 3 and intfn and zipfile.is_zipfile(fn):
src = zipfile.ZipFile(fn, "r").read(intfn.strip("/"))
if not src:
src = ""
if type(src) is not str:
src = src.decode("utf-8")
return plugin_meta_extract(src, fn)
# Actual comment extraction logic
def plugin_meta_extract(src="", fn=None, literal=False):
|
|
|
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
intfn = add + "/" + intfn
if len(fn) >= 3 and intfn and zipfile.is_zipfile(fn):
src = zipfile.ZipFile(fn, "r").read(intfn.strip("/"))
if not src:
src = ""
if type(src) is not str:
src = src.decode("utf-8", errors='replace')
return plugin_meta_extract(src, fn)
# Actual comment extraction logic
def plugin_meta_extract(src="", fn=None, literal=False):
|