pep585 and pathlib updates

This commit is contained in:
OMEGARAZER
2023-01-25 22:23:59 -05:00
parent e96b167b71
commit cf5f7bfd16
14 changed files with 31 additions and 28 deletions

View File

@@ -10,11 +10,11 @@ import re
import shutil
import socket
from abc import ABCMeta, abstractmethod
from collections.abc import Callable, Iterable, Iterator
from datetime import datetime
from enum import Enum, auto
from pathlib import Path
from time import sleep
from typing import Callable, Iterable, Iterator
import appdirs
import praw
@@ -119,7 +119,7 @@ class RedditConnector(metaclass=ABCMeta):
)
logger.debug(f"Setting filename restriction scheme to '{self.args.filename_restriction_scheme}'")
# Update config on disk
with open(self.config_location, "w") as file:
with Path(self.config_location).open(mode="w") as file:
self.cfg_parser.write(file)
def parse_disabled_modules(self):
@@ -143,7 +143,7 @@ class RedditConnector(metaclass=ABCMeta):
)
token = oauth2_authenticator.retrieve_new_token()
self.cfg_parser["DEFAULT"]["user_token"] = token
with open(self.config_location, "w") as file:
with Path(self.config_location).open(mode="w") as file:
self.cfg_parser.write(file, True)
token_manager = OAuth2TokenManager(self.cfg_parser, self.config_location)