Best Python code snippet using avocado_python
tool_text_json.py
Source:tool_text_json.py
...65 self.unicodeToChinese = False66 else:67 self.unicodeToChinese = True68 self.json_parse(sort_keys=True, indent=4, separators=(', ', ': '), ensure_ascii=self.chineseToUnicode)69 def json_base64_decode(self, result):70 print("json_unicode_to_chinese", result)71 if result == 0:72 self.base64Decode = True73 else:74 self.base64Decode = False75 self.json_parse(sort_keys=True, indent=4, separators=(', ', ': '), ensure_ascii=self.base64Decode)76 def json_clean(self):77 self.originTextEdit.clear()78 self.resultTextEdit.clear()79 def show_json_in_tree_view(self, json_data):80 tree_model = QStandardItemModel()81 self.treeView.setModel(tree_model)82 self.treeView.model().setHorizontalHeaderLabels(['Key', 'Values'])83 self.set_tree_view_model_data(tree_model.invisibleRootItem(), json_data)...
utils.py
Source:utils.py
1import base642import json3class StatusMsgInvalidJSONError(Exception):4 """Status message does not contain valid JSON."""5def json_base64_decode(dct):6 """base64 decode object hook for custom JSON encoding."""7 key_name = '__base64_encoded__'8 if key_name in dct:9 return base64.b64decode(dct[key_name])10 return dct11def json_loads(data):12 """Loads and decodes JSON, with added base64 decoding.13 :param data: either bytes or a string. If bytes, will be decoded14 using the current default encoding.15 :raises:16 :returns: decoded Python objects17 """18 if isinstance(data, bytes):19 data = data.decode()...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!