mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: port use of nested in recipes
This commit is contained in:
parent
45975b0c39
commit
c1eb2f9523
@ -10,7 +10,6 @@ import os
|
|||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from contextlib import nested
|
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre.ebooks.metadata.toc import TOC
|
from calibre.ebooks.metadata.toc import TOC
|
||||||
@ -302,5 +301,5 @@ class AppleDaily(BasicNewsRecipe):
|
|||||||
opf.create_spine(entries)
|
opf.create_spine(entries)
|
||||||
opf.set_toc(toc)
|
opf.set_toc(toc)
|
||||||
|
|
||||||
with nested(open(opf_path, 'wb'), open(ncx_path, 'wb')) as (opf_file, ncx_file):
|
with open(opf_path, 'wb') as opf_file, open(ncx_path, 'wb') as ncx_file:
|
||||||
opf.render(opf_file, ncx_file)
|
opf.render(opf_file, ncx_file)
|
||||||
|
@ -78,7 +78,6 @@ import datetime
|
|||||||
import re
|
import re
|
||||||
import mechanize
|
import mechanize
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from contextlib import nested
|
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre.ebooks.metadata.toc import TOC
|
from calibre.ebooks.metadata.toc import TOC
|
||||||
@ -1177,5 +1176,5 @@ class MPRecipe(BasicNewsRecipe):
|
|||||||
opf.create_spine(entries)
|
opf.create_spine(entries)
|
||||||
opf.set_toc(toc)
|
opf.set_toc(toc)
|
||||||
|
|
||||||
with nested(open(opf_path, 'wb'), open(ncx_path, 'wb')) as (opf_file, ncx_file):
|
with open(opf_path, 'wb') as opf_file, open(ncx_path, 'wb') as ncx_file:
|
||||||
opf.render(opf_file, ncx_file)
|
opf.render(opf_file, ncx_file)
|
||||||
|
@ -70,7 +70,6 @@ import datetime
|
|||||||
import re
|
import re
|
||||||
import mechanize
|
import mechanize
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from contextlib import nested
|
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre.ebooks.metadata.toc import TOC
|
from calibre.ebooks.metadata.toc import TOC
|
||||||
@ -1015,5 +1014,5 @@ class MPRecipe(BasicNewsRecipe):
|
|||||||
opf.create_spine(entries)
|
opf.create_spine(entries)
|
||||||
opf.set_toc(toc)
|
opf.set_toc(toc)
|
||||||
|
|
||||||
with nested(open(opf_path, 'wb'), open(ncx_path, 'wb')) as (opf_file, ncx_file):
|
with open(opf_path, 'wb') as opf_file, open(ncx_path, 'wb') as ncx_file:
|
||||||
opf.render(opf_file, ncx_file)
|
opf.render(opf_file, ncx_file)
|
||||||
|
@ -70,7 +70,6 @@ import datetime
|
|||||||
import re
|
import re
|
||||||
import mechanize
|
import mechanize
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from contextlib import nested
|
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre.ebooks.metadata.toc import TOC
|
from calibre.ebooks.metadata.toc import TOC
|
||||||
@ -1015,5 +1014,5 @@ class MPRecipe(BasicNewsRecipe):
|
|||||||
opf.create_spine(entries)
|
opf.create_spine(entries)
|
||||||
opf.set_toc(toc)
|
opf.set_toc(toc)
|
||||||
|
|
||||||
with nested(open(opf_path, 'wb'), open(ncx_path, 'wb')) as (opf_file, ncx_file):
|
with open(opf_path, 'wb') as opf_file, open(ncx_path, 'wb') as ncx_file:
|
||||||
opf.render(opf_file, ncx_file)
|
opf.render(opf_file, ncx_file)
|
||||||
|
@ -31,7 +31,6 @@ import os
|
|||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from contextlib import nested
|
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre.ebooks.metadata.toc import TOC
|
from calibre.ebooks.metadata.toc import TOC
|
||||||
@ -527,5 +526,5 @@ class STHKRecipe(BasicNewsRecipe):
|
|||||||
opf.create_spine(entries)
|
opf.create_spine(entries)
|
||||||
opf.set_toc(toc)
|
opf.set_toc(toc)
|
||||||
|
|
||||||
with nested(open(opf_path, 'wb'), open(ncx_path, 'wb')) as (opf_file, ncx_file):
|
with open(opf_path, 'wb') as opf_file, open(ncx_path, 'wb') as ncx_file:
|
||||||
opf.render(opf_file, ncx_file)
|
opf.render(opf_file, ncx_file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user