Permalink
Browse files

Clean up file reading in js.py.

  • Loading branch information...
1 parent eb8c88c commit 5c64a33edb48ba8cb29d792f8265899494b2144c @chromakode chromakode committed with spladug Mar 23, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 r2/r2/lib/js.py
View
@@ -99,7 +99,8 @@ def __init__(self, name):
self.name = name
def get_source(self):
- return open(self.path).read()
+ with open(self.path) as f:
+ return f.read()
@property
def path(self):
@@ -256,7 +257,8 @@ def languagize_path(path, lang):
def build(self, closure):
Module.build(self, closure)
- reddit_source = open(self.path).read()
+ with open(self.path) as f:
+ reddit_source = f.read()
string_keys = re.findall("r\.strings\(['\"]([\w$_]+)['\"]", reddit_source)
string_keys.append("permissions")

0 comments on commit 5c64a33

Please sign in to comment.