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

[async-function-with-timeout] Disable check for asyncio before Python 3.11 (ASYNC109) #13023

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[async-function-with-timeout] Disable diagnostic for asyncio before P…
…ython3.11 (ASYNC109)
  • Loading branch information
vdwees committed Aug 21, 2024

Verified

This commit was signed with the committer’s verified signature.
vdwees jesse
commit bf8d84dcd291eaebcb84539b0408e00d0192da1f
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ use ruff_text_size::Ranged;

use crate::checkers::ast::Checker;
use crate::rules::flake8_async::helpers::AsyncModule;
use crate::settings::types::PythonVersion;

/// ## What it does
/// Checks for `async` functions with a `timeout` argument.
@@ -86,6 +87,11 @@ pub(crate) fn async_function_with_timeout(
AsyncModule::AsyncIo
};

// asyncio.timeout feature was first introduced in Python 3.11
if module == AsyncModule::AsyncIo && checker.settings.target_version < PythonVersion::Py311 {
return;
}

checker.diagnostics.push(Diagnostic::new(
AsyncFunctionWithTimeout { module },
timeout.range(),