mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
use context managers to open files where possible
This commit is contained in:
parent
31bd771cf9
commit
de17dd27c9
@ -32,7 +32,8 @@ _html_css_stylesheet = None
|
|||||||
def html_css_stylesheet():
|
def html_css_stylesheet():
|
||||||
global _html_css_stylesheet
|
global _html_css_stylesheet
|
||||||
if _html_css_stylesheet is None:
|
if _html_css_stylesheet is None:
|
||||||
html_css = open(P('templates/html.css'), 'rb').read()
|
with open(P('templates/html.css'), 'rb') as f:
|
||||||
|
html_css = f.read()
|
||||||
_html_css_stylesheet = parseString(html_css, validate=False)
|
_html_css_stylesheet = parseString(html_css, validate=False)
|
||||||
return _html_css_stylesheet
|
return _html_css_stylesheet
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user