MCPcopy Create free account
hub / github.com/ActiveState/code / parseFile

Function parseFile

recipes/Python/496910_easy_file_parsing/recipe-496910.py:4–13  ·  view source on GitHub ↗
(filename, envin, envout = {})

Source from the content-addressed store, hash-verified

2from os import dirname
3
4def parseFile(filename, envin, envout = {}):
5 exec "from sys import path" in envin
6 exec "path.append(\"" + dirname(filename) + "\")" in envin
7 envin.pop("path")
8 lines = open(filename, 'r').read()
9 exec lines in envin
10 returndict = {}
11 for key in envout:
12 returndict[key] = envin[key]
13 return returndict

Callers

nothing calls this directly

Calls 3

openFunction · 0.50
popMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected