MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / copy_env

Function copy_env

pythonwhat/utils.py:36–51  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

34
35
36def copy_env(env):
37 mutableTypes = (tuple, list, dict)
38 # One list comprehension to filter list. Might need some cleaning, but it
39 # works
40 ipy_ignore = ["In", "Out", "get_ipython", "quit", "exit"]
41 update_env = {
42 key: copy.deepcopy(value)
43 for key, value in env.items()
44 if not any(
45 (key.startswith("_"), isinstance(value, ModuleType), key in ipy_ignore)
46 )
47 and isinstance(value, mutableTypes)
48 }
49 updated_env = dict(env)
50 updated_env.update(update_env)
51 return updated_env
52
53
54def first_lower(s):

Callers

nothing calls this directly

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected