---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:18:14
   |
18 | def foo(var: "MyClass") -> "MyClass":
   |              ^^^^^^^^^
19 |     x: "MyClass"
   |
help: Remove quotes
   |
17 |
   - def foo(var: "MyClass") -> "MyClass":
18 + def foo(var: MyClass) -> "MyClass":
19 |     x: "MyClass"
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:18:28
   |
18 | def foo(var: "MyClass") -> "MyClass":
   |                            ^^^^^^^^^
19 |     x: "MyClass"
   |
help: Remove quotes
   |
17 |
   - def foo(var: "MyClass") -> "MyClass":
18 + def foo(var: "MyClass") -> MyClass:
19 |     x: "MyClass"
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:19:8
   |
18 | def foo(var: "MyClass") -> "MyClass":
19 |     x: "MyClass"
   |        ^^^^^^^^^
   |
help: Remove quotes
   |
18 | def foo(var: "MyClass") -> "MyClass":
   -     x: "MyClass"
19 +     x: MyClass
20 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:22:21
   |
22 | def foo(*, inplace: "bool"):
   |                     ^^^^^^
23 |     pass
   |
help: Remove quotes
   |
21 |
   - def foo(*, inplace: "bool"):
22 + def foo(*, inplace: bool):
23 |     pass
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:26:16
   |
26 | def foo(*args: "str", **kwargs: "int"):
   |                ^^^^^
27 |     pass
   |
help: Remove quotes
   |
25 |
   - def foo(*args: "str", **kwargs: "int"):
26 + def foo(*args: str, **kwargs: "int"):
27 |     pass
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:26:33
   |
26 | def foo(*args: "str", **kwargs: "int"):
   |                                 ^^^^^
27 |     pass
   |
help: Remove quotes
   |
25 |
   - def foo(*args: "str", **kwargs: "int"):
26 + def foo(*args: "str", **kwargs: int):
27 |     pass
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:30:10
   |
30 | x: Tuple["MyClass"]
   |          ^^^^^^^^^
31 |
32 | x: Callable[["MyClass"], None]
   |
help: Remove quotes
   |
29 |
   - x: Tuple["MyClass"]
30 + x: Tuple[MyClass]
31 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:32:14
   |
30 | x: Tuple["MyClass"]
31 |
32 | x: Callable[["MyClass"], None]
   |              ^^^^^^^^^
   |
help: Remove quotes
   |
31 |
   - x: Callable[["MyClass"], None]
32 + x: Callable[[MyClass], None]
33 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:36:8
   |
35 | class Foo(NamedTuple):
36 |     x: "MyClass"
   |        ^^^^^^^^^
   |
help: Remove quotes
   |
35 | class Foo(NamedTuple):
   -     x: "MyClass"
36 +     x: MyClass
37 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:40:27
   |
39 | class D(TypedDict):
40 |     E: TypedDict("E", foo="int", total=False)
   |                           ^^^^^
   |
help: Remove quotes
   |
39 | class D(TypedDict):
   -     E: TypedDict("E", foo="int", total=False)
40 +     E: TypedDict("E", foo=int, total=False)
41 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:44:31
   |
43 | class D(TypedDict):
44 |     E: TypedDict("E", {"foo": "int"})
   |                               ^^^^^
   |
help: Remove quotes
   |
43 | class D(TypedDict):
   -     E: TypedDict("E", {"foo": "int"})
44 +     E: TypedDict("E", {"foo": int})
45 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:47:14
   |
47 | x: Annotated["str", "metadata"]
   |              ^^^^^
48 |
49 | x: Arg("str", "name")
   |
help: Remove quotes
   |
46 |
   - x: Annotated["str", "metadata"]
47 + x: Annotated[str, "metadata"]
48 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:49:8
   |
47 | x: Annotated["str", "metadata"]
48 |
49 | x: Arg("str", "name")
   |        ^^^^^
50 |
51 | x: DefaultArg("str", "name")
   |
help: Remove quotes
   |
48 |
   - x: Arg("str", "name")
49 + x: Arg(str, "name")
50 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:51:15
   |
49 | x: Arg("str", "name")
50 |
51 | x: DefaultArg("str", "name")
   |               ^^^^^
52 |
53 | x: NamedArg("str", "name")
   |
help: Remove quotes
   |
50 |
   - x: DefaultArg("str", "name")
51 + x: DefaultArg(str, "name")
52 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:53:13
   |
51 | x: DefaultArg("str", "name")
52 |
53 | x: NamedArg("str", "name")
   |             ^^^^^
54 |
55 | x: DefaultNamedArg("str", "name")
   |
help: Remove quotes
   |
52 |
   - x: NamedArg("str", "name")
53 + x: NamedArg(str, "name")
54 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:55:20
   |
53 | x: NamedArg("str", "name")
54 |
55 | x: DefaultNamedArg("str", "name")
   |                    ^^^^^
56 |
57 | x: DefaultNamedArg("str", name="name")
   |
help: Remove quotes
   |
54 |
   - x: DefaultNamedArg("str", "name")
55 + x: DefaultNamedArg(str, "name")
56 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:57:20
   |
55 | x: DefaultNamedArg("str", "name")
56 |
57 | x: DefaultNamedArg("str", name="name")
   |                    ^^^^^
58 |
59 | x: VarArg("str")
   |
help: Remove quotes
   |
56 |
   - x: DefaultNamedArg("str", name="name")
57 + x: DefaultNamedArg(str, name="name")
58 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:59:11
   |
57 | x: DefaultNamedArg("str", name="name")
58 |
59 | x: VarArg("str")
   |           ^^^^^
60 |
61 | x: List[List[List["MyClass"]]]
   |
help: Remove quotes
   |
58 |
   - x: VarArg("str")
59 + x: VarArg(str)
60 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:61:19
   |
59 | x: VarArg("str")
60 |
61 | x: List[List[List["MyClass"]]]
   |                   ^^^^^^^^^
62 |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
   |
help: Remove quotes
   |
60 |
   - x: List[List[List["MyClass"]]]
61 + x: List[List[List[MyClass]]]
62 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:63:29
   |
61 | x: List[List[List["MyClass"]]]
62 |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
   |                             ^^^^^
64 |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
   |
help: Remove quotes
   |
62 |
   - x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
63 + x: NamedTuple("X", [("foo", int), ("bar", "str")])
64 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:63:45
   |
61 | x: List[List[List["MyClass"]]]
62 |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
   |                                             ^^^^^
64 |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
   |
help: Remove quotes
   |
62 |
   - x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
63 + x: NamedTuple("X", [("foo", "int"), ("bar", str)])
64 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:65:29
   |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
64 |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
   |                             ^^^^^
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |
help: Remove quotes
   |
64 |
   - x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
65 + x: NamedTuple("X", fields=[(foo, "int"), ("bar", "str")])
66 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:65:36
   |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
64 |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
   |                                    ^^^^^
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |
help: Remove quotes
   |
64 |
   - x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
65 + x: NamedTuple("X", fields=[("foo", int), ("bar", "str")])
66 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:65:45
   |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
64 |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
   |                                             ^^^^^
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |
help: Remove quotes
   |
64 |
   - x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
65 + x: NamedTuple("X", fields=[("foo", "int"), (bar, "str")])
66 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:65:52
   |
63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")])
64 |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
   |                                                    ^^^^^
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |
help: Remove quotes
   |
64 |
   - x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
65 + x: NamedTuple("X", fields=[("foo", "int"), ("bar", str)])
66 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:67:24
   |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |                        ^^^
68 |
69 | X: MyCallable("X")
   |
help: Remove quotes
   |
66 |
   - x: NamedTuple(typename="X", fields=[("foo", "int")])
67 + x: NamedTuple(typename=X, fields=[("foo", "int")])
68 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:67:38
   |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |                                      ^^^^^
68 |
69 | X: MyCallable("X")
   |
help: Remove quotes
   |
66 |
   - x: NamedTuple(typename="X", fields=[("foo", "int")])
67 + x: NamedTuple(typename="X", fields=[(foo, "int")])
68 |
   |

UP037 [*] Remove quotes from type annotation
  --> UP037_0.py:67:45
   |
65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")])
66 |
67 | x: NamedTuple(typename="X", fields=[("foo", "int")])
   |                                             ^^^^^
68 |
69 | X: MyCallable("X")
   |
help: Remove quotes
   |
66 |
   - x: NamedTuple(typename="X", fields=[("foo", "int")])
67 + x: NamedTuple(typename="X", fields=[("foo", int)])
68 |
   |

UP037 [*] Remove quotes from type annotation
   --> UP037_0.py:112:12
    |
110 | # Handle end of line comment in string annotation
111 | # See https://github.com/astral-sh/ruff/issues/15816
112 | def f() -> "Literal[0]#":
    |            ^^^^^^^^^^^^^
113 |     return 0
    |
help: Remove quotes
    |
111 | # See https://github.com/astral-sh/ruff/issues/15816
    - def f() -> "Literal[0]#":
112 + def f() -> (Literal[0]#
113 + ):
114 |     return 0
    |

UP037 [*] Remove quotes from type annotation
   --> UP037_0.py:115:10
    |
113 |     return 0
114 |
115 | def g(x: "Literal['abc']#") -> None:
    |          ^^^^^^^^^^^^^^^^^
116 |     return
    |
help: Remove quotes
    |
114 |
    - def g(x: "Literal['abc']#") -> None:
115 + def g(x: (Literal['abc']#
116 + )) -> None:
117 |     return
    |

UP037 [*] Remove quotes from type annotation
   --> UP037_0.py:118:12
    |
116 |       return
117 |
118 |   def f() -> """Literal[0]
    |  ____________^
119 | |     #
120 | |     
121 | |     """:
    | |_______^
122 |       return 0
    |
help: Remove quotes
    |
117 |
    - def f() -> """Literal[0]
118 + def f() -> (Literal[0]
119 |     #
120 |     
    -     """:
121 +     
122 + ):
123 |     return 0
    |

UP037 [*] Remove quotes from type annotation
   --> UP037_0.py:125:14
    |
124 | # https://github.com/astral-sh/ruff/issues/19835
125 | def foo(bar: "A\n#"): ...
    |              ^^^^^^
126 | def foo(bar: "A\n#\n"): ...
    |
help: Remove quotes
    |
124 | # https://github.com/astral-sh/ruff/issues/19835
    - def foo(bar: "A\n#"): ...
125 + def foo(bar: (A
126 + #
127 + )): ...
128 | def foo(bar: "A\n#\n"): ...
    |

UP037 [*] Remove quotes from type annotation
   --> UP037_0.py:126:14
    |
124 | # https://github.com/astral-sh/ruff/issues/19835
125 | def foo(bar: "A\n#"): ...
126 | def foo(bar: "A\n#\n"): ...
    |              ^^^^^^^^
    |
help: Remove quotes
    |
125 | def foo(bar: "A\n#"): ...
    - def foo(bar: "A\n#\n"): ...
126 + def foo(bar: (A
127 + #
128 +
129 + )): ...
    |
