-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Neyberson/utils #24
Neyberson/utils #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mira no quiero revisar esto por que me parece que tiene demasiado errores
es bajo la calidad esperada
devtools/protocol.py
Outdated
@@ -59,4 +59,55 @@ def run_print(debug): | |||
thread_print = Thread(target=run_print, args=(debug,)) | |||
thread_print.start() | |||
|
|||
# we need to do something for errors | |||
def verify_json_id(self, json_list, message_id, session_id=None, target_id=None): | |||
for json_ in json_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
que es el _?
devtools/protocol.py
Outdated
# we need to do something for errors | ||
def verify_json_id(self, json_list, message_id, session_id=None, target_id=None): | ||
for json_ in json_list: | ||
if message_id in json_ and message_id == json["id"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no entiendo que hace esto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
que es json? no hay tal variable?
return json_obj["result"]["targetId"] | ||
else: | ||
if "targetId" in json_obj["params"]: | ||
return json_obj["params"]["targetId"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hay un params en un json recibido?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sí
elif "result" in json_obj and "sessionId" in json_obj["result"]: | ||
return json_obj["result"]["sessionId"] | ||
else: | ||
return json_obj["params"]["sessionId"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
este en un resultado o parte de un comando que enviamos?
def verify_json_list( | ||
self, json_list, verify_function, verify_boolean=False, debug=False | ||
): | ||
for json_ in json_list: | ||
self.verify_json_error(json_) | ||
verify_boolean = verify_function(json_) | ||
if verify_boolean: | ||
json_obj = json_ | ||
if debug: | ||
print(f">>>>>This is the json_obj: {json_obj}") | ||
return json_obj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no es necesario
def verify_json_error(self, json): | ||
if "error" in json: | ||
if "id" in json: | ||
raise ValueError( | ||
f"The command with id {json["id"]} raise an error. Error code: {json["error"]["code"]}. {json["error"]["message"]}" | ||
) | ||
else: | ||
raise ValueError( | ||
f"Error code: {json["error"]["code"]}. {json["error"]["message"]}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todavia no leventamos errores, solo debe devolver la informacion sobre el error, supongo
No description provided.