aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/parsers/abstract_parser.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-07-19 15:02:13 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2020-07-19 15:02:13 -0500
commit461cb78f0a56b9293b5ade10fe90ec4aa77d23ad (patch)
tree8dc05802dd09b38b7766da886190871daf3b6667 /config_file/parsers/abstract_parser.py
parentRemove zsh info and add extras sub header (diff)
downloadconfig-file-461cb78f0a56b9293b5ade10fe90ec4aa77d23ad.zip
Change name of BaseParser to AbstractParser
Diffstat (limited to 'config_file/parsers/abstract_parser.py')
-rw-r--r--config_file/parsers/abstract_parser.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/config_file/parsers/abstract_parser.py b/config_file/parsers/abstract_parser.py
index da6e90a..8f1bee1 100644
--- a/config_file/parsers/abstract_parser.py
+++ b/config_file/parsers/abstract_parser.py
@@ -2,7 +2,7 @@ from abc import ABC, abstractmethod
from typing import Any
-class BaseParser(ABC):
+class AbstractParser(ABC):
"""
The abstract base parser for all other parsers to implement.
@@ -26,6 +26,14 @@ class BaseParser(ABC):
self.parsed_content = self.parse(self.content)
@abstractmethod
+ def parse(self, file_contents: str) -> Any:
+ """
+ Parse the file_contents into an internal representation
+ the given parser can work with.
+ """
+ raise NotImplementedError
+
+ @abstractmethod
def get(self, key: str, parse_types: bool = False, all: bool = False) -> Any:
"""
Retrieve the value of a key in its native type.
@@ -62,14 +70,6 @@ class BaseParser(ABC):
using a section.key format.
Some formats, like JSON, do not have sections and therefore,
- it would only be checking if
- """
- raise NotImplementedError
-
- @abstractmethod
- def parse(self, file_contents: str) -> Any:
- """
- Parse the file_contents into an internal representation
- the given parser can work with.
+ it would only be checking if a certain key exists.
"""
raise NotImplementedError