change rules check

import ast




class VideoStream():


    def __init__(self):


        self.rules= {}


        self._OldRules = None


        self._NewRules= None


    


    @property


    def NewRules(self):


        return self._NewRules


        


    @NewRules.setter


    def NewRules(self, newData):


        self._NewRules = newData


        if not self._OldRules:


            self._OldRules = self._NewRules


            self.processData(newData)


            


        else:


            for ids in newData.keys():


                if ids in self._OldRules.keys():


                    self._OldRules[ids] = newData[ids]


                    print("same id is ther", self._OldRules)


                    self.processData(self._OldRules)


                    return self.rules


                else:

                    self._OldRules.update(newData)

                    self.processData(self._OldRules)


                    return self.rules


            


        


    


    def processData(self, newData):


        processedRules = {}


        for inner_dict in newData.values():


            processedRules.update(inner_dict)


        self.rules= processedRules


        return processedRules


        


    


    


video = VideoStream()




video.NewRules= {1: {'ram': 'off'} }




while True:


    input_str= input("Enter new dict:: \n") 


    new_dict = ast.literal_eval(input_str)


    video.NewRules= new_dict

    

    print('oLdrULES=',"\n\n", video._OldRules , "\n\n")

    print('Rules=',"\n\n", video.rules , "\n\n")

Comments

Popular posts from this blog

WR3D wwe 2k19 MOD apk direct download link for Android

Download wwe2k17 wr3d

How to make resizeable window in pygame and make content adjustable according to window size