Skip to content

Commit e651e19

Browse files
authored
typing: Remove quoted type hints (#829)
1 parent be57b28 commit e651e19

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎tests/profiler/plot_memory_timeline.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Reads memory traces from json files and plots them on a single graph.
44
"""
55

6+
from __future__ import annotations
7+
68
import argparse
79
import json
810
from dataclasses import dataclass
@@ -24,7 +26,7 @@ class MemoryFrame:
2426
device_id: int # -1 for CPU, 0+ for CUDA devices
2527

2628
@staticmethod
27-
def from_event(event: dict) -> "MemoryFrame":
29+
def from_event(event: dict) -> MemoryFrame:
2830
args = event["args"]
2931
return MemoryFrame(
3032
timestamp=event["ts"],

‎tests/trajectories/_objectives.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from abc import ABC, abstractmethod
24

35
import torch
@@ -77,7 +79,7 @@ def quad(x: Tensor, A: Tensor, u: Tensor) -> Tensor:
7779
return x_minus_u @ A @ x_minus_u
7880

7981
@property
80-
def sps_mapping(self) -> "QuadraticSPSMapping":
82+
def sps_mapping(self) -> QuadraticSPSMapping:
8183
return QuadraticSPSMapping(self.As, self.us)
8284

8385

@@ -118,7 +120,7 @@ def jacobian(self, x: Tensor) -> Tensor:
118120
return torch.diag(torch.stack([2 * x[0], 2 * x[1]]))
119121

120122
@property
121-
def sps_mapping(self) -> "ElementWiseQuadraticSPSMapping":
123+
def sps_mapping(self) -> ElementWiseQuadraticSPSMapping:
122124
return ElementWiseQuadraticSPSMapping(self.n_values)
123125

124126

‎tests/trajectories/_plotters.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from abc import ABC, abstractmethod
24
from typing import TypeAlias
35

@@ -16,7 +18,7 @@ class Plotter(ABC):
1618
def __call__(self, ax: plt.Axes) -> None:
1719
pass
1820

19-
def __add__(self, other: "Plotter") -> "Plotter":
21+
def __add__(self, other: Plotter) -> Plotter:
2022
return MultiPlotter((self, other))
2123

2224

@@ -30,7 +32,7 @@ def __call__(self, ax: plt.Axes) -> None:
3032
class MultiPlotter(Plotter):
3133
"""Plotter applying several plotters."""
3234

33-
def __init__(self, plotters: tuple["Plotter", ...]) -> None:
35+
def __init__(self, plotters: tuple[Plotter, ...]) -> None:
3436
self.plotters = plotters
3537

3638
def __call__(self, ax: plt.Axes) -> None:

0 commit comments

Comments
 (0)