Use pathclass.Path.makedirs.
This commit is contained in:
parent
3373e36f64
commit
c27f8038c7
6 changed files with 6 additions and 6 deletions
|
@ -94,7 +94,7 @@ def breakdown_argparse(args):
|
|||
|
||||
breakdown_basename = breakdown_basename % database.filepath.replace_extension('').basename
|
||||
breakdown_filepath = database.breakdown_dir.with_child(breakdown_basename)
|
||||
os.makedirs(breakdown_filepath.parent.absolute_path, exist_ok=True)
|
||||
breakdown_filepath.parent.makedirs(exist_ok=True)
|
||||
breakdown_file = breakdown_filepath.open('w')
|
||||
with breakdown_file:
|
||||
breakdown_file.write(dump)
|
||||
|
|
|
@ -12,7 +12,7 @@ def get_styles(subreddit):
|
|||
subreddit = common.r.subreddit(subreddit)
|
||||
styles = subreddit.stylesheet()
|
||||
|
||||
os.makedirs(database.styles_dir.absolute_path, exist_ok=True)
|
||||
database.styles_dir.makedirs(exist_ok=True)
|
||||
|
||||
stylesheet_filepath = database.styles_dir.with_child('stylesheet.css')
|
||||
print('Downloading %s' % stylesheet_filepath.relative_path)
|
||||
|
|
|
@ -15,7 +15,7 @@ def get_wiki(subreddit):
|
|||
continue
|
||||
|
||||
wikipage_path = database.wiki_dir.join(wikipage.name).replace_extension('md')
|
||||
os.makedirs(wikipage_path.parent.absolute_path, exist_ok=True)
|
||||
wikipage_path.parent.makedirs(exist_ok=True)
|
||||
with wikipage_path.open('w', encoding='utf-8') as handle:
|
||||
handle.write(wikipage.content_md)
|
||||
print('Wrote', wikipage_path.relative_path)
|
||||
|
|
|
@ -108,7 +108,7 @@ def index_worker(
|
|||
statement = statement.format(threshold=score_threshold, order=orderby)
|
||||
cur.execute(statement)
|
||||
|
||||
os.makedirs(database.index_dir.absolute_path, exist_ok=True)
|
||||
database.index_dir.makedirs(exist_ok=True)
|
||||
|
||||
extension = '.html' if html else '.txt'
|
||||
mash_basename = database.filepath.replace_extension('').basename
|
||||
|
|
|
@ -209,7 +209,7 @@ def html_from_database(database, specific_submission=None):
|
|||
submission_trees = trees_from_database(database, specific_submission)
|
||||
for submission_tree in submission_trees:
|
||||
page = html_from_tree(submission_tree, sort=lambda x: x.data.score * -1)
|
||||
os.makedirs(database.offline_reading_dir.absolute_path, exist_ok=True)
|
||||
database.offline_reading_dir.makedirs(exist_ok=True)
|
||||
|
||||
html = ''
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ class TSDB:
|
|||
raise exceptions.DatabaseNotFound(self.filepath)
|
||||
print('New database', self.filepath.relative_path)
|
||||
|
||||
os.makedirs(self.filepath.parent.absolute_path, exist_ok=True)
|
||||
self.filepath.parent.makedirs(exist_ok=True)
|
||||
|
||||
self.breakdown_dir = self.filepath.parent.with_child('breakdown')
|
||||
self.offline_reading_dir = self.filepath.parent.with_child('offline_reading')
|
||||
|
|
Loading…
Reference in a new issue