From 7a4c2048508047bd2a04f8fe817a3addfd9ebd66 Mon Sep 17 00:00:00 2001 From: Nigel Dokter Date: Sat, 21 Jan 2017 10:42:17 +0100 Subject: [PATCH] added code comments --- dsmr_parser/objects.py | 3 +-- dsmr_parser/parsers.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dsmr_parser/objects.py b/dsmr_parser/objects.py index 890dd50..9489d97 100644 --- a/dsmr_parser/objects.py +++ b/dsmr_parser/objects.py @@ -43,5 +43,4 @@ class CosemObject(DSMRObject): class ProfileGeneric(DSMRObject): - pass - # TODO implement + pass # TODO implement diff --git a/dsmr_parser/parsers.py b/dsmr_parser/parsers.py index 069c02a..478b518 100644 --- a/dsmr_parser/parsers.py +++ b/dsmr_parser/parsers.py @@ -91,6 +91,9 @@ class TelegramParser(object): class DSMRObjectParser(object): + """ + Parses an object (can also be see as a 'line') from a telegram. + """ def __init__(self, *value_formats): self.value_formats = value_formats @@ -181,6 +184,15 @@ class ProfileGenericParser(DSMRObjectParser): class ValueParser(object): + """ + Parses a single value from DSMRObject's. + + Example with coerce_type being int: + (002*A) becomes {'value': 1, 'unit': 'A'} + + Example with coerce_type being str: + (42) becomes {'value': '42', 'unit': None} + """ def __init__(self, coerce_type): self.coerce_type = coerce_type