Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

fix/feat: ability to use asyncio.run with Snake.start and Snake.start_gateway #346

Merged
merged 8 commits into from
Mar 10, 2022

Conversation

arHSM
Copy link
Contributor

@arHSM arHSM commented Mar 1, 2022

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change

Description

Converted Snake.start and Snake.start_gateway to async methods inorder to enforce to use if asyncio.run.
Additionally this PR removes the use of a loop attribute.

Changes

Removed the loop attribute from the following classes:

  • Snake
  • HTTPClient
  • WebsocketClient

Changed the following methods from non-async to async:

  • Snake.start
  • Snake.start_gateway

Removed the loop and asyncio_debug keyword arg from Snake
Also removed start_gateway keyword arg from Snake.login

Checklist

  • I've formatted my code with Black
  • I've ensured my code works on Python 3.10.x
  • I've tested my code

dis_snek/client/client.py Outdated Show resolved Hide resolved
@arHSM arHSM changed the title fix/feat: ability to use asyncio.run with Snake.start and Snake.start… fix/feat: ability to use asyncio.run with Snake.start and Snake.start_gateway Mar 1, 2022
dis_snek/api/http/http_client.py Outdated Show resolved Hide resolved
dis_snek/api/http/http_client.py Outdated Show resolved Hide resolved
dis_snek/client/client.py Outdated Show resolved Hide resolved
dis_snek/models/snek/wait.py Outdated Show resolved Hide resolved
@benwoo1110 benwoo1110 added the Improvement Something that is already implemented but can be done better label Mar 2, 2022
@arHSM arHSM requested a review from benwoo1110 March 5, 2022 14:34
Copy link
Contributor

@benwoo1110 benwoo1110 left a comment

Choose a reason for hiding this comment

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

generally looks good

dis_snek/client/client.py Show resolved Hide resolved
@LordOfPolls
Copy link
Member

If youre removing asyncio debug, you'll need to remove it from debug scale too. By default it enables the asyncio's debug logging

@LordOfPolls LordOfPolls merged commit 902f6a5 into NAFTeam:dev Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Improvement Something that is already implemented but can be done better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants