box.py: removed the unneeded open()

in with session.open(), contextmanager already calls open()
Added classmethods to create instances from JSON

JSON objects are decoded as dictionaries, added
classmethods to populate instances from dict values
Restore the session.open() call

The to avoid calling session.open() twice will be in __enter__()
Added encode/decode tests

For JobDefinition, ResourceExpression and JobResultTests
Fix broken tests where session.update_job_state_map() is now missing
Session can now be resumed from the JSON file

Added the update_job_state_map method to avoid modifying the
job_state_map with __init__(), This is required to decode JSON objects
as dict and create session instances. Resuming/updating SessionState
with previous data requires an object_hook parameter (dict_to_object),
used to create python class instances from dictionaries.
previous_sesion_file() check if a previous session file exists and
returns its full pathname. resume_prompt() is for now a pure CLI prompt
to get user input.
Cleanup after cherry picking
Removed uneeded ResourceExpression encoder/decoder helpers

The _readiness_inhibitor_list will be recomputed on resume
Don't save the _readiness_inhibitor_list, it will be evaluated on resume
Added tests for JobState encode/decode to json
Reworked test_session.py after cherry-picking

Mainly to use _get_persistance_subset() instead of __getstate__()
Removed deprecated code
Created a class/identifier mapping

To be used in serialization operations
PEP8 fixes
Restore the job identity check in the result setter of JobState
"[r=zkrynicki][bug=][author=zkrynicki] automatic merge by tarmac"
"[r=zkrynicki][bug=][author=sylvain-pineau] automatic merge by tarmac"
exporter: drop the yaml exporter

The YAML exporter was made as a demo of "we can have different exporters"
functionality but was never really used for anything or intended to be
used (having json around). This cuts the annoying dependency on pyYAML
so let's get rid of it

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
"[r=roadmr][bug=][author=zkrynicki] automatic merge by tarmac"
Session can now be resumed from the JSON file

Added the update_job_state_map method to avoid modifying the
job_state_map with __init__(), This is required to decode JSON objects
as dict and create session instances. Resuming/updating SessionState
with previous data requires an object_hook parameter (dict_to_object),
used to create python class instances from dictionaries.
previous_sesion_file() check if a previous session file exists and
returns its full pathname. resume_prompt() is for now a pure CLI prompt
to get user input.
Added some empty lines to SessionState comments

Just for readability