Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Rename serialize functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkin committed Sep 27, 2016
1 parent 28bc2ac commit 1c947ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions qubesdbus/domain_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def main(args=None):
''' Main function ''' # pylint: disable=unused-argument
loop = GLib.MainLoop()
app = qubes.Qubes()
data = qubesdbus.serialize.qubes(app)
domains = [qubesdbus.serialize.domain(vm) for vm in app.domains]
data = qubesdbus.serialize.qubes_data(app)
domains = [qubesdbus.serialize.domain_data(vm) for vm in app.domains]
_ = DomainManager(data, domains)
print("Service running...")
loop.run()
Expand Down
2 changes: 1 addition & 1 deletion qubesdbus/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def main(args=None):
loop = GLib.MainLoop()
app = qubes.Qubes()

labels_data = [qubesdbus.serialize.label(label)
labels_data = [qubesdbus.serialize.label_data(label)
for label in app.labels.values()]
_ = Labels(labels_data)
print("Service running...")
Expand Down
11 changes: 3 additions & 8 deletions qubesdbus/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@
'is_qrexec_running', ]


def _init_states(states):
# type: (List[str]) -> Dict[str,Callable[[str, bool], Tuple[str,dbus.Boolean]]]
result = {
} # type: Dict[str,Callable[[str, bool], Tuple[str,dbus.Boolean]]]

def qubes(app):
def qubes_data(app):
''' Serialize `qubes.Qubes` to a dictionary '''
# type: (Qubes) -> Dict[dbus.String, Any]
result = {}
Expand All @@ -102,7 +97,7 @@ def qubes(app):

return result

def domain(vm):
def domain_data(vm):
''' Serializes a `qubes.vm.qubesvm.QubesVM` to a dictionary '''
# type: (QubesVM) -> Dict[dbus.String, Any]
result = {dbus.String('state'): 'halted'}
Expand Down Expand Up @@ -130,7 +125,7 @@ def domain(vm):
return result


def label(lab):
def label_data(lab):
# type: (Label) -> Dict[dbus.String, Any]
result = {}
for name in dir(lab):
Expand Down

0 comments on commit 1c947ee

Please sign in to comment.