aboutsummaryrefslogtreecommitdiffstats
path: root/wlp.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2018-04-03 11:39:59 +0200
committerMatěj Cepl <mcepl@cepl.eu>2019-10-02 12:29:46 +0200
commit606078cabb24ddf1e2cb29175e6d7deae73f5749 (patch)
tree2105f8fbbbb6abbde70c14322d7dfc3c3ebc75be /wlp.py
parentdf2683228cfb151dad3e78a624181af6fc771545 (diff)
downloadpygn-606078cabb24ddf1e2cb29175e6d7deae73f5749.tar.gz
Global variables are evil. Tests under both py2k and py3k pass.
Diffstat (limited to 'wlp.py')
-rw-r--r--wlp.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/wlp.py b/wlp.py
index 64d7361..aaef6e8 100644
--- a/wlp.py
+++ b/wlp.py
@@ -1,27 +1,11 @@
-# -*- coding: utf-8 -*-
import wlp_parser
-__current_file = None
-
-
-def setfilebyname(name):
- global __current_file
- __current_file = open(name, 'r')
-
-
-def setfilebyfd(fd):
- global __current_file
- __current_file = fd
-
-
-def mkdict():
+def mkdict(infile):
dict = {}
- if __current_file is None:
- raise ValueError('current file has not been set.')
tree = wlp_parser.parser.parse(
- wlp_parser.lexer.lex(__current_file.read()))
+ wlp_parser.lexer.lex(infile.read()))
for subtree in tree:
current_key = subtree[0].getstr().strip('<>')