Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs1-25sp
lecture-code
Commits
976f5c63
Commit
976f5c63
authored
1 month ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
setup mystery.py
parent
8814bf42
master
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
14/mystery.py
+1
-0
14/mystery.py
14/ref.py
+38
-0
14/ref.py
14/reference/.gitkeep
+0
-0
14/reference/.gitkeep
with
39 additions
and
0 deletions
+39
-0
14/mystery.py
0 → 100644
View file @
976f5c63
from
ref
import
f
,
g
,
h
,
i
,
j
,
k
This diff is collapsed.
Click to expand it.
14/ref.py
0 → 100644
View file @
976f5c63
import
importlib
import
sys
import
requests
def
get
(
x
):
version
=
''
.
join
(
sys
.
version
.
split
(
" "
)[
0
].
split
(
"."
)[:
-
1
])
result
=
requests
.
get
(
f
'https://gitlab.caltech.edu/blank/mysterypy/-/raw/master/
{
x
}
.cpython-
{
version
}
.pyc'
)
with
open
(
f
'reference/
{
x
}
.pyc'
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
cnt
=
0
def
load
(
x
):
global
cnt
try
:
spec
=
importlib
.
util
.
spec_from_file_location
(
x
,
f
"reference/
{
x
}
.pyc"
)
mod
=
importlib
.
util
.
module_from_spec
(
spec
)
spec
.
loader
.
exec_module
(
mod
)
except
FileNotFoundError
:
if
cnt
==
0
:
cnt
+=
1
get
(
x
)
return
load
(
x
)
cnt
=
0
return
None
cnt
=
0
return
mod
secret
=
load
(
'secret'
)
f
=
secret
.
f
g
=
secret
.
g
h
=
secret
.
h
i
=
secret
.
i
j
=
secret
.
j
k
=
secret
.
k
This diff is collapsed.
Click to expand it.
14/reference/.gitkeep
0 → 100644
View file @
976f5c63
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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
Menu
Projects
Groups
Snippets
Help