Repository: androguard/androguard
Issue: AnalyzeDex/ODex documentation discrepancies

In release 3.2.1 the [AnalyzeDex ](https://github.com/androguard/androguard/blob/master/androguard/misc.py#L81)[documentation](https://androguard.readthedocs.io/en/latest/api/androguard.html?highlight=analyzedex#androguard.misc.AnalyzeDex) states the function returns two objects (DalvikVMFormat and Analysis), but actually it returns a (sha256 string, DalvikVMFormat, and Analysis) since it is calling down the addDex function in [session.py](https://github.com/androguard/androguard/blob/v.3.2.1/androguard/session.py)

The same discrepancy occurs with the [AnalyzeODex ](https://github.com/androguard/androguard/blob/master/androguard/misc.py#L102)and addDEY.  






Changed files:
androguard/misc.py, androguard/session.py

diff --git a/androguard/misc.py b/androguard/misc.py
index b4f514d0..528e0161 100644
--- a/androguard/misc.py
+++ b/androguard/misc.py
@@ -1,4 +1,4 @@
-from androguard import session
+from androguard.session import Session
 from androguard.decompiler import decompiler
 from androguard.core import androconf
 import hashlib
@@ -24,7 +24,7 @@ def get_default_session():
     or create a new one, if the session in the configuration is None.
     """
     if androconf.CONF["SESSION"] is None:
-        androconf.CONF["SESSION"] = session.Session()
+        androconf.CONF["SESSION"] = Session()
     return androconf.CONF["SESSION"]
 
 
@@ -46,7 +46,6 @@ def AnalyzeAPK(_file, session=None, raw=False):
     """
     log.debug("AnalyzeAPK")
 
-
     if session:
         log.debug("Using existing session {}".format(session))
         if raw:
@@ -82,11 +81,11 @@ def AnalyzeDex(filename, session=None):
     """
     Analyze an android dex file and setup all stuff for a more quickly analysis !
 
-    :param session: A session (Default None)
     :param filename: the filename of the android dex file or a buffer which represents the dex file
     :type filename: string
+    :param session: A session (Default None)
 
-    :rtype: return the :class:`DalvikVMFormat`, and :class:`Analysis` objects
+    :rtype: return a tuple of (sha256hash, :class:`DalvikVMFormat`, :class:`Analysis`)
     """
     log.debug("AnalyzeDex")
 
@@ -107,7 +106,7 @@ def AnalyzeODex(filename, session=None):
     :type filename: string
     :param session: The Androguard Session to add the ODex to (default: None)
 
-    :rtype: return the :class:`DalvikOdexVMFormat`, and :class:`Analysis` objects
+    :rtype: return a tuple of (sha256hash, :class:`DalvikOdexVMFormat`, :class:`Analysis`)
     """
     log.debug("AnalyzeODex")
 
diff --git a/androguard/session.py b/androguard/session.py
index 9c1b7de9..1c33c267 100644
--- a/androguard/session.py
+++ b/androguard/session.py
@@ -45,10 +45,10 @@ def Load(filename):
 
 class Session(object):
     def __init__(self, export_ipython=False):
-        self._setupObjects()
+        self._setup_objects()
         self.export_ipython = export_ipython
 
-    def _setupObjects(self):
+    def _setup_objects(self):
         self.analyzed_files = collections.OrderedDict()
         self.analyzed_digest = {}
         self.analyzed_apk = {}
@@ -59,7 +59,7 @@ class Session(object):
         """
         Reset the current session, delete all added files.
         """
-        self._setupObjects()
+        self._setup_objects()
 
     def isOpen(self):
         """
@@ -170,16 +170,23 @@ class Session(object):
         return digest, d, dx
 
     def add(self, filename, raw_data, dx=None):
+        """
+        Generic method to add a file to the session.
+        It guesses the filetype and calls the correct method.
+
+        :param filename: filename to load
+        :param raw_data: bytes of the file
+        :param dx: An already exiting :class:`~androguard.core.analysis.analysis.Analysis` object
+        :return: the sha256 of the file or None on failure
+        """
         ret = androconf.is_android_raw(raw_data)
-        digest = None
         if not ret:
             return None
         self.analyzed_files[filename] = []
         if ret == "APK":
             digest, apk = self.addAPK(filename, raw_data)
-            dex_files = list(apk.get_all_dex())
             dx = self.analyzed_vms.get(digest)
-            for dex in dex_files:
+            for dex in apk.get_all_dex():
                 _, d, dx = self.addDEX(filename, dex, dx)
         elif ret == "DEX":
             digest, d, _ = self.addDEX(filename, raw_data)