Skip to content

Commit

Permalink
Removed redundant call to __init__() and replaced os.makdirs with pat…
Browse files Browse the repository at this point in the history
…hlib.Path.mkdir
  • Loading branch information
MuditJ committed Feb 29, 2024
1 parent 2cad495 commit 51d7e52
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions smassh/src/parser/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from json import load, dump
import os
from pathlib import Path
from typing import Any, Dict

Expand All @@ -14,16 +13,14 @@ def combine_into(d: dict, to: dict) -> None:

class Parser:
"""
A sub class of ConfigParser class
to parse the currenty set options in the settings menu
The base class for ConfigParser and DataParser classes
"""

_file_name = "smassh"
_file_name: str = "smassh"
config_path: Path
DEFAULT_CONFIG: Dict[str, Any]

def __init__(self) -> None:
super().__init__()
self.config = self.DEFAULT_CONFIG.copy()
if not Path.is_file(self.full_path):
self._create_user_config()
Expand Down Expand Up @@ -58,7 +55,7 @@ def _create_user_config(self) -> None:
Creates a new config
"""

os.makedirs(self.config_path, exist_ok=True)
Path(self.config_path).makedir(parents=True, exist_ok=True)
self.save()

def get(self, data: str) -> Any:
Expand Down

0 comments on commit 51d7e52

Please sign in to comment.