Skip to content

Commit b00e77a

Browse files
authored
Merge pull request #205 from jakkdl/remove_117
remove trio117, as MultiError is removed in trio 0.24.0
2 parents dffdf7d + c28b7e5 commit b00e77a

File tree

5 files changed

+10
-73
lines changed

5 files changed

+10
-73
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
*[CalVer, YY.month.patch](https://calver.org/)*
33

4+
## Future
5+
- Removed TRIO117, MultiError removed in trio 0.24.0
6+
47
## 23.5.1
58
- TRIO91X now supports comprehensions
69
- TRIO100 and TRIO91X now supports autofixing

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ pip install flake8-trio
3232
- **TRIO104**: `Cancelled` and `BaseException` must be re-raised - when a user tries to `return` or `raise` a different exception.
3333
- **TRIO105**: Calling a trio async function without immediately `await`ing it.
3434
- **TRIO106**: `trio` must be imported with `import trio` for the linter to work.
35-
- **TRIO107**: Renamed to TRIO910
36-
- **TRIO108**: Renamed to TRIO911
3735
- **TRIO109**: Async function definition with a `timeout` parameter - use `trio.[fail/move_on]_[after/at]` instead
3836
- **TRIO110**: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`.
3937
- **TRIO111**: Variable, from context manager opened inside nursery, passed to `start[_soon]` might be invalidly accessed while in use, due to context manager closing before the nursery. This is usually a bug, and nurseries should generally be the inner-most context manager.
@@ -42,7 +40,6 @@ pip install flake8-trio
4240
- **TRIO114**: Startable function (i.e. has a `task_status` keyword parameter) not in `--startable-in-context-manager` parameter list, please add it so TRIO113 can catch errors when using it.
4341
- **TRIO115**: Replace `trio.sleep(0)` with the more suggestive `trio.lowlevel.checkpoint()`.
4442
- **TRIO116**: `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`.
45-
- **TRIO117**: Don't raise or catch `trio.[NonBase]MultiError`, prefer `[exceptiongroup.]BaseExceptionGroup`. Even if Trio still raises `MultiError` for legacy code, it can be caught with `BaseExceptionGroup` so it's fully redundant.
4643
- **TRIO118**: Don't assign the value of `anyio.get_cancelled_exc_class()` to a variable, since that breaks linter checks and multi-backend programs.
4744

4845
### Warnings for blocking sync calls in async functions
@@ -58,13 +55,17 @@ pip install flake8-trio
5855
- **TRIO232**: Blocking sync call on file object, wrap the file object in `trio.wrap_file()` to get an async file object.
5956
- **TRIO240**: Avoid using `os.path` in async functions, prefer using `trio.Path` objects.
6057

61-
6258
### Warnings disabled by default
6359
- **TRIO900**: Async generator without `@asynccontextmanager` not allowed.
6460
- **TRIO910**: Exit or `return` from async function with no guaranteed checkpoint or exception since function definition.
6561
- **TRIO911**: Exit, `yield` or `return` from async iterable with no guaranteed checkpoint since possible function entry (yield or function definition)
6662
Checkpoints are `await`, `async for`, and `async with` (on one of enter/exit).
6763

64+
### Removed Warnings
65+
- **TRIO107**: Renamed to TRIO910
66+
- **TRIO108**: Renamed to TRIO911
67+
- **TRIO117**: Don't raise or catch `trio.[NonBase]MultiError`, prefer `[exceptiongroup.]BaseExceptionGroup`. `MultiError` was removed in trio==0.24.0.
68+
6869
## Examples
6970
### install and run through flake8
7071
```sh

flake8_trio/visitors/visitors.py

-20
Original file line numberDiff line numberDiff line change
@@ -264,26 +264,6 @@ def visit_Call(self, node: ast.Call):
264264
self.error(node, m[2])
265265

266266

267-
DEPRECATED_ERRORS = ("MultiError", "NonBaseMultiError")
268-
269-
270-
# anyio does not have MultiError, so this check is trio-only
271-
@error_class
272-
class Visitor117(Flake8TrioVisitor):
273-
error_codes: Mapping[str, str] = {
274-
"TRIO117": "Reference to {}, prefer [exceptiongroup.]BaseExceptionGroup.",
275-
}
276-
277-
# This should never actually happen given TRIO106
278-
def visit_Name(self, node: ast.Name):
279-
if node.id in DEPRECATED_ERRORS and "trio" in self.library:
280-
self.error(node, node.id)
281-
282-
def visit_Attribute(self, node: ast.Attribute):
283-
if (n := ast.unparse(node)) in ("trio.MultiError", "trio.NonBaseMultiError"):
284-
self.error(node, n)
285-
286-
287267
@error_class
288268
@disabled_by_default
289269
class Visitor900(Flake8TrioVisitor):

tests/eval_files/trio117.py

-47
This file was deleted.

tests/test_messages_documented.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
CHANGELOG = ROOT_PATH / "CHANGELOG.md"
1414
README = CHANGELOG.parent / "README.md"
1515

16-
# 107 & 108 are removed (but still mentioned in changelog & readme)
16+
# 107, 108 & 117 are removed (but still mentioned in changelog & readme)
1717
# TRIOxxx_* are fake codes to get different error messages for the same code
18-
IGNORED_CODES_REGEX = r"TRIO107|TRIO108|TRIO\d\d\d_.*"
18+
IGNORED_CODES_REGEX = r"TRIO107|TRIO108|TRIO117|TRIO\d\d\d_.*"
1919

2020

2121
def test_messages_documented():

0 commit comments

Comments
 (0)