1
0
mirror of https://github.com/2martens/uni.git synced 2026-05-06 19:36:26 +02:00

[OE-Drucken] Improved documentation and error handling

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2015-04-30 11:33:00 +02:00
parent 6b34d9edbf
commit d2a7853c5d

View File

@ -12,18 +12,21 @@ class Config:
def load_build(self, build): def load_build(self, build):
""" """
Loads the data of a particular build Loads the data of a particular build or an empty object if no such build exists
:type build: str :type build: str
:rtype: object :rtype: dict
""" """
build_data = self.config_data[build] if build in self.config_data:
build_data = self.config_data[build]
else:
build_data = {}
return build_data return build_data
def load_json_file(self): def load_json_file(self):
""" """
Loads the JSON configuration file Loads the JSON configuration file
:type self: config.Config :type self: config.Config
:rtype : object :rtype : dict
""" """
file = open(self.config_file, 'r', encoding='utf-8') file = open(self.config_file, 'r', encoding='utf-8')
json_data = json.load(file) json_data = json.load(file)