Skip to content

Commit

Permalink
Fixup typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith- committed Jun 18, 2024
1 parent f9bb34f commit 3576fc2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/correctionlib/schemav2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math
import sys
from collections import defaultdict
from typing import Annotated, Dict, List, Optional, Set, Tuple, Union
from typing import Dict, List, Optional, Set, Tuple, Union

from pydantic import (
AfterValidator,
Expand All @@ -20,10 +20,14 @@

import correctionlib.highlevel

if sys.version_info >= (3, 8):
if sys.version_info >= (3, 9):
from typing import Annotated, Literal
elif sys.version_info >= (3, 8):
from typing import Literal

from typing_extensions import Annotated
else:
from typing_extensions import Literal
from typing_extensions import Annotated, Literal


VERSION = 2
Expand Down Expand Up @@ -302,8 +306,8 @@ def summarize(
) -> None:
nodecount["MultiBinning"] += 1
for input, edges in zip(self.inputs, self.edges):
low = edges[0] if isinstance(edges, list) else edges.low
high = edges[-1] if isinstance(edges, list) else edges.high
low = float(edges[0]) if isinstance(edges, list) else edges.low
high = float(edges[-1]) if isinstance(edges, list) else edges.high
inputstats[input].overflow &= self.flow != "error"
inputstats[input].min = min(inputstats[input].min, low)
inputstats[input].max = max(inputstats[input].max, high)
Expand Down

0 comments on commit 3576fc2

Please sign in to comment.