Skip to content

Commit

Permalink
Explicitly declare units field in PintType
Browse files Browse the repository at this point in the history
Improve mypy compatibility by declaring `units` to be a field of PintType.

Signed-off-by: Michael Tiemann <[email protected]>
  • Loading branch information
MichaelTiemannOSC committed Jan 13, 2024
1 parent 94975eb commit c5c7d8c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pint_pandas/pint_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import warnings
from importlib.metadata import version
from typing import Optional

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -43,6 +44,7 @@ class PintType(ExtensionDtype):
# str = '|O08'
# base = np.dtype('O')
# num = 102
units: Optional[_Unit] = None # Filled in by `construct_from_..._string`
_metadata = ("units",)
_match = re.compile(r"(P|p)int\[(?P<units>.+)\]")
_cache = {}
Expand Down

0 comments on commit c5c7d8c

Please sign in to comment.