mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Make use of pathlib nearly everywhere (breaks docs gen)
Python 3.6 introduced support for the os.PathLike interface, which means Python 3.5 did not have it yet and attempting to use it in os functions would fail. Instead we can use pathlib for everything, but not all work is done yet.
This commit is contained in:
@@ -54,7 +54,7 @@ class DocsWriter:
|
||||
<body>
|
||||
<div id="main_div">''',
|
||||
title=title,
|
||||
rel_css=relative_css_path.rstrip('/'),
|
||||
rel_css=str(relative_css_path).rstrip('/'),
|
||||
def_css=default_css
|
||||
)
|
||||
|
||||
@@ -278,10 +278,7 @@ class DocsWriter:
|
||||
# With block
|
||||
def __enter__(self):
|
||||
# Sanity check
|
||||
parent = os.path.dirname(self.filename)
|
||||
if parent:
|
||||
os.makedirs(parent, exist_ok=True)
|
||||
|
||||
self.filename.parent.mkdir(parents=True, exist_ok=True)
|
||||
self.handle = open(self.filename, 'w', encoding='utf-8')
|
||||
return self
|
||||
|
||||
|
Reference in New Issue
Block a user