Passport.py
def submit_form(self, form: tp.Dict[str, tp.Any]) -> bool:
        """
        accepts a JSON form, validates it and assigns
        form contents to instance's properties if form is valid (returns True).
        If validation failed - returns False and does nothing.
        """

        # validate form
        reference_form = {
            "session_start_time": "01-01-1970 00:00:00",
            "product_type": "Perseverance Mars rover",
            "production_stage": "Final assembly",
            "additional_info":
                {
                    "field_1": "Sample text",
                    "field_2": "Sample text",
                    "field_3": "Sample text"
                }
        }

        form_keys = list(form.keys())
        form_keys.sort()
        reference_form_keys = list(reference_form.keys())
        reference_form_keys.sort()

        if form_keys == reference_form_keys:
            self.session_start_time = form["session_start_time"]
            self.product_type = form["product_type"]
            self.additional_info = form["additional_info"]
            self.workplace_data = form["production_stage"]

            return True

        else:
            logging.error(f"Error validating form data. Key mismatch with reference model")
            return False

        accepts a JSON form, validates it and assigns
        form contents to instance's properties if form is valid (returns True).
        If validation failed - returns False and does nothing.
        
accepts a JSON form, validates it and assigns
form contents to instance's properties if form is valid (returns True).
If validation failed - returns False and does nothing.
accepts a JSON form validates it and assigns form contents to instance ' s properties if form is valid ( returns True ) . If validation failed - returns False and does nothing .
def submit_form(self, form: tp.Dict[str, tp.Any]) -> bool:
        reference_form = {
            "session_start_time": "01-01-1970 00:00:00",
            "product_type": "Perseverance Mars rover",
            "production_stage": "Final assembly",
            "additional_info":
                {
                    "field_1": "Sample text",
                    "field_2": "Sample text",
                    "field_3": "Sample text"
                }
        }
        form_keys = list(form.keys())
        form_keys.sort()
        reference_form_keys = list(reference_form.keys())
        reference_form_keys.sort()
        if form_keys == reference_form_keys:
            self.session_start_time = form["session_start_time"]
            self.product_type = form["product_type"]
            self.additional_info = form["additional_info"]
            self.workplace_data = form["production_stage"]
            return True
        else:
            logging.error(f"Error validating form data. Key mismatch with reference model")
            return False
def submit_form ( self , form : tp . Dict [ str , tp . Any ] ) -> bool : reference_form = { "session_start_time" : "01-01-1970 00:00:00" , "product_type" : "Perseverance Mars rover" , "production_stage" : "Final assembly" , "additional_info" : { "field_1" : "Sample text" , "field_2" : "Sample text" , "field_3" : "Sample text" } } form_keys = list ( form . keys ( ) ) form_keys . sort ( ) reference_form_keys = list ( reference_form . keys ( ) ) reference_form_keys . sort ( ) if form_keys == reference_form_keys : self . session_start_time = form [ "session_start_time" ] self . product_type = form [ "product_type" ] self . additional_info = form [ "additional_info" ] self . workplace_data = form [ "production_stage" ] return True else : logging . error ( f"Error validating form data. Key mismatch with reference model" ) return False
accepts a JSON form, validates it and assigns
form contents to instance's properties if form is valid (returns True).
accepts a JSON form validates it and assigns form contents to instance ' s properties if form is valid ( returns True ) .
"""
        accepts a JSON form, validates it and assigns
        form contents to instance's properties if form is valid (returns True).
        If validation failed - returns False and does nothing.
        """ # validate form
self
form
tp.Dict[str, tp.Any]