Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zheng Yile
codiaclient
Commits
e3983dd9
Commit
e3983dd9
authored
Jul 07, 2021
by
Zheng Yile
Browse files
Delete readCache.py
parent
e091caa2
Changes
1
Hide whitespace changes
Inline
Side-by-side
readCache.py
deleted
100644 → 0
View file @
e091caa2
import
json
import
zlib
from
base64
import
b64decode
from
codiaclient.report
import
report
variables
=
{
'cache_on'
:
True
}
def
cache_load
(
file
=
'./codiaclient.cache'
):
if
not
variables
[
'cache_on'
]:
report
(
"Invalid reference of function 'cache_load'."
,
1
)
return
False
try
:
with
open
(
file
,
'rb'
)
as
f
:
dic_ziped
=
f
.
read
()
dic_b64
=
zlib
.
decompress
(
dic_ziped
)
dic_str
=
b64decode
(
dic_b64
).
decode
(
'utf-8'
)
config
=
json
.
loads
(
dic_str
)
if
'logindic'
in
config
:
variables
[
'logindic'
]
=
config
[
'logindic'
]
except
(
zlib
.
error
,
UnicodeDecodeError
,
json
.
decoder
.
JSONDecodeError
):
report
(
'Cache load failed.'
,
1
)
except
FileNotFoundError
:
pass
cache_load
()
print
(
json
.
dumps
(
variables
,
indent
=
2
))
input
(
'Press any key to continue...'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment