diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-11-14 13:23:12 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-11-14 22:11:19 +0100 |
commit | 904116553df1ac3d3ef5ecc88df33d04be29cf50 (patch) | |
tree | 64e66d0f3ce5d1dd52c714979076e7089b8392c9 /formats | |
parent | 79360db8e405d520379027cc73c02b08f28b1fc0 (diff) | |
download | clufter-904116553df1ac3d3ef5ecc88df33d04be29cf50.tar.gz clufter-904116553df1ac3d3ef5ecc88df33d04be29cf50.tar.xz clufter-904116553df1ac3d3ef5ecc88df33d04be29cf50.zip |
format: make passing protocol/protodecl optional
It is usually not used internally to allow "1 function, more roles"
anyway.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'formats')
-rw-r--r-- | formats/command.py | 6 | ||||
-rw-r--r-- | formats/simpleconfig.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/formats/command.py b/formats/command.py index 6613dde..f38897a 100644 --- a/formats/command.py +++ b/formats/command.py @@ -16,7 +16,7 @@ class command(SimpleFormat): MERGED = Protocol('merged') @SimpleFormat.producing(BYTESTRING) - def get_bytestring(self, protocol): + def get_bytestring(self, *protodecl): """Return command as canonical single string""" # try to look (indirectly) if we have a file at hand first ret = super(command, self).get_bytestring(self.BYTESTRING) @@ -27,7 +27,7 @@ class command(SimpleFormat): return ' '.join(self.MERGED(protect_safe=True)) @SimpleFormat.producing(SEPARATED, protect=True) - def get_separated(self, protocol): + def get_separated(self, *protodecl): ret = self.MERGED(protect_safe=True) newret, acc = [], [] for i in ret: @@ -42,7 +42,7 @@ class command(SimpleFormat): return newret @SimpleFormat.producing(MERGED, protect=True) - def get_merged(self, protocol): + def get_merged(self, *protodecl): # try to look (indirectly) if we have "separated" at hand first if self.BYTESTRING in self._representations: # break the possible loop from shlex import split diff --git a/formats/simpleconfig.py b/formats/simpleconfig.py index 57408a1..04df34b 100644 --- a/formats/simpleconfig.py +++ b/formats/simpleconfig.py @@ -45,7 +45,7 @@ class simpleconfig(SimpleFormat): BYTESTRING = SimpleFormat.BYTESTRING @SimpleFormat.producing(BYTESTRING) - def get_bytestring(self, protocol): + def get_bytestring(self, *protodecl): """Externalize 'struct', that is basically, pretty print it For example above, the result is something like: @@ -115,6 +115,6 @@ class simpleconfig(SimpleFormat): return ret @SimpleFormat.producing(STRUCT, protect=True) - def get_struct(self, protocol): + def get_struct(self, *protodecl): # TODO parsing struct from string raise NotImplementedError |