Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Neyberson/utils #24

wants to merge 5 commits into from

Conversation

neyberson
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@ayjayt ayjayt left a 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 Show resolved Hide resolved
@@ -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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

que es el _?

# 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"]:
Copy link
Collaborator

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?

Copy link
Collaborator

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"]
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +87 to +91
elif "result" in json_obj and "sessionId" in json_obj["result"]:
return json_obj["result"]["sessionId"]
else:
return json_obj["params"]["sessionId"]

Copy link
Collaborator

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?

Comment on lines +92 to +102
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no es necesario

Comment on lines +104 to +113
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"]}"
)
Copy link
Collaborator

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

@ayjayt ayjayt closed this Sep 3, 2024
@neyberson neyberson deleted the neyberson/utils branch September 4, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants