Skip to content

return the registration status from remove_reader/remove_writer #660

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

graingert
Copy link
Contributor

No description provided.

@entelligence-ai-reviews

Walkthrough

This update modifies the Loop class in uvloop to improve the feedback provided by its public API methods for removing readers and writers. By returning the result of the internal removal methods, callers can now determine if a callback was actually removed, enhancing the usability and consistency of the event loop interface. No new methods were introduced, and the core logic remains unchanged.

Changes

File(s) Summary
uvloop/loop.pyx Updated 'remove_reader' and 'remove_writer' methods to return the result of their internal counterparts (_remove_reader and _remove_writer) instead of None, providing feedback to the caller.

Sequence Diagram

This diagram shows the interactions between components:

sequenceDiagram
    title Event Loop Reader/Writer Management Flow
    
    participant Client as "Client Code"
    participant EventLoop as "Event Loop"
    participant Internal as "Internal Methods"
    
    Note over EventLoop: Before change: remove methods didn't return values
    Note over EventLoop: After change: remove methods return values from internal methods
    
    %% Reader operations
    Client->>EventLoop: add_reader(fileobj, callback, *args)
    activate EventLoop
    EventLoop->>Internal: _add_reader(fileobj, callback, *args)
    activate Internal
    Internal-->>EventLoop: result
    deactivate Internal
    EventLoop-->>Client: None
    deactivate EventLoop
    
    %% Writer operations
    Client->>EventLoop: add_writer(fileobj, callback, *args)
    activate EventLoop
    EventLoop->>Internal: _add_writer(fileobj, callback, *args)
    activate Internal
    Internal-->>EventLoop: result
    deactivate Internal
    EventLoop-->>Client: None
    deactivate EventLoop
    
    %% Remove reader - showing the change
    Client->>EventLoop: remove_reader(fileobj)
    activate EventLoop
    EventLoop->>Internal: _remove_reader(fileobj)
    activate Internal
    Internal-->>EventLoop: result (boolean)
    deactivate Internal
    
    alt Before change
        EventLoop-->>Client: None (result discarded)
    else After change
        EventLoop-->>Client: result (boolean)
        Note over Client, EventLoop: Now returns True if a reader was removed, False otherwise
    end
    deactivate EventLoop
    
    %% Remove writer - showing the change
    Client->>EventLoop: remove_writer(fileobj)
    activate EventLoop
    EventLoop->>Internal: _remove_writer(fileobj)
    activate Internal
    Internal-->>EventLoop: result (boolean)
    deactivate Internal
    
    alt Before change
        EventLoop-->>Client: None (result discarded)
    else After change
        EventLoop-->>Client: result (boolean)
        Note over Client, EventLoop: Now returns True if a writer was removed, False otherwise
    end
    deactivate EventLoop
Loading

▶️AI Code Reviews for VS Code, Cursor, Windsurf
Install the extension

Note for Windsurf Please change the default marketplace provider to the following in the windsurf settings:

Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery

Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @entelligenceai + *your message*
Example: @entelligenceai Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @entelligenceai + *feedback*
Example: @entelligenceai Do not comment on `save_auth` function !

Also you can trigger various commands with the bot by doing
@entelligenceai command

The current supported commands are

  1. config - shows the current config
  2. retrigger_review - retriggers the review

More commands to be added soon.

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.

3 participants