How to use __dump method in ATX

Best Python code snippet using ATX

database.py

Source:database.py Github

copy

Full Screen

...13 _rm:'room.db',14 }15 def __init__(self, menu = 'dev_db/'):16 self.menu = menu17 def __dump(self, p):18 try:19 dev_path = self.menu + p20 f = open(dev_path)21 dev_str = f.read()22 s = json.dumps(json.loads(dev_str, encoding='utf-8'))23 return s24 except Exception as e:25 print('database read error',e)26 return None27 def dump_dev(self):28 return self.__dump(self.path[self._dev])29 def dump_sce(self):30 return self.__dump(self.path[self._sce])31 def dump_flr(self):32 return self.__dump(self.path[self._flr])33 def dump_rm(self):34 return self.__dump(self.path[self._rm])35 def dumps(self, cmd):36 if cmd in self.path:37 return self.__dump(self.path[cmd])38 else:39 return None40# d = Database()41# print(d.dump_dev())42# print(d.dump_sce())43# print(d.dump_flr())...

Full Screen

Full Screen

dao.py

Source:dao.py Github

copy

Full Screen

...7 self.__cache = {}8 try:9 self.__load()10 except FileNotFoundError:11 self.__dump()12 def __dump(self):13 pickle.dump(self.__cache, open(self.__datasource, 'wb'))14 def __load(self):15 self.__cache = pickle.load(open(self.__datasource, 'rb'))16 def add(self, key, obj):17 self.__cache[key] = obj18 self.__dump()19 def get(self, key):20 try:21 return self.__cache[key]22 except KeyError:23 pass24 def remove(self, key):25 try:26 self.__cache.pop(key)27 self.__dump()28 except KeyError:29 pass30 def get_all(self):31 return self.__cache.values()32 def update(self, key, obj):33 try:34 if (self.__cache[key] != None):35 self.__cache[key] = obj36 self.__dump()37 except KeyError:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful