Ejemplo n.º 1
0
def get_hash(f, context=None, hash_funcs=None):
    hasher = hashlib.new("md5")
    ch = _CodeHasher(hash_funcs=hash_funcs)
    ch._get_main_script_directory = MagicMock()
    ch._get_main_script_directory.return_value = os.getcwd()
    ch.update(hasher, f, context)
    return hasher.digest()
Ejemplo n.º 2
0
 def __init__(self, hash_funcs):
     """Initialize GlobalState instance."""
     self.__dict__["_state"] = {
         "data": {},
         "hash": None,
         "hasher": _CodeHasher(hash_funcs),
         "is_rerun": False,
     }
Ejemplo n.º 3
0
 def __init__(self, session, hash_funcs):
     self.__dict__["_state"] = {
         "data": {},
         "hash": None,
         "hasher": _CodeHasher(hash_funcs),
         "is_rerun": False,
         "session": session,
     }
Ejemplo n.º 4
0
 def __init__(self, session):
     """Initialize SessionState instance."""
     self.__dict__["_state"] = {
         "data": {},
         "hash": None,
         "hasher": _CodeHasher(),
         "is_rerun": False,
         "session": session,
     }
Ejemplo n.º 5
0
 def __init__(self, session):
     """Initialize SessionState instance."""
     # Attributes are initialized through __dict__ to avoid calling __setattr__.
     self.__dict__.update({
         "_code_hasher": _CodeHasher(),
         "_item_rerun": set(),
         "_session": session,
         "_state": {}
     })
Ejemplo n.º 6
0
 def __init__(self, session, hash_funcs, **kwargs):
     """Initialize SessionState instance."""
     self.__dict__["_state"] = {
         "data": {},
         "hash": None,
         "hasher": _CodeHasher(hash_funcs),
         "is_rerun": False,
         "session": session,
         "session_id": id(session),
     }
     self.__call__(**kwargs)
Ejemplo n.º 7
0
 def __init__(self, session, hash_funcs, **kwargs):
     """Initialize SessionState instance."""
     self.__dict__["_state"] = {
         "data": {},
         "hash": None,
         "hasher": _CodeHasher(hash_funcs),
         "is_rerun": False,
         "session": session,
         "session_id": id(session),
     }
     for key, value in kwargs.items():
         self.__setattr__(key, value)
    def __init__(
        self,
        session: Union[SessionState, ReportSession],
    ) -> None:

        self.__dict__["_state"] = {
            "data": {},
            "hash": None,
            "hasher": _CodeHasher(),
            "is_rerun": False,
            "session": session,
        }