Skip to content

Commit a9c6ff1

Browse files
committed
moving optional to union |
1 parent fc86407 commit a9c6ff1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dbldatagen/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import warnings
1616
from collections.abc import Callable
1717
from datetime import timedelta
18-
from typing import Any, Optional
18+
from typing import Any
1919

2020
import jmespath
2121

@@ -49,11 +49,11 @@ class DataGenError(Exception):
4949
:param baseException: underlying exception, if any that caused the issue
5050
"""
5151

52-
def __init__(self, msg: str, baseException: Optional[Exception] = None) -> None:
52+
def __init__(self, msg: str, baseException: object | None = None) -> None:
5353
""" constructor
5454
"""
5555
super().__init__(msg)
56-
self._underlyingException: Optional[Exception] = baseException
56+
self._underlyingException: object | None = baseException
5757
self._msg: str = msg
5858

5959
def __repr__(self) -> str:
@@ -63,7 +63,7 @@ def __str__(self) -> str:
6363
return f"DataGenError(msg='{self._msg}', baseException={self._underlyingException})"
6464

6565

66-
def coalesce_values(*args: object) -> Optional[object]:
66+
def coalesce_values(*args: object) -> object | None:
6767
"""For a supplied list of arguments, returns the first argument that does not have the value `None`
6868
6969
:param args: variable list of arguments which are evaluated
@@ -91,7 +91,7 @@ def strip_margin(text: str) -> str:
9191
raise DataGenError(strip_margin(msg))
9292

9393

94-
def mkBoundsList(x: Optional[int | list[int]], default: int | list[int]) -> tuple[bool, list[int]]:
94+
def mkBoundsList(x: int | list[int] | None, default: int | list[int]) -> tuple[bool, list[int]]:
9595
""" make a bounds list from supplied parameter - otherwise use default
9696
9797
:param x: integer or list of 2 values that define bounds list
@@ -113,7 +113,7 @@ def mkBoundsList(x: Optional[int | list[int]], default: int | list[int]) -> tupl
113113

114114
def topologicalSort(
115115
sources: list[tuple[str, set[str]]],
116-
initial_columns: Optional[list[str]] = None,
116+
initial_columns: list[str] | None = None,
117117
flatten: bool = True
118118
) -> list[str] | list[list[str]]:
119119
""" Perform a topological sort over sources

0 commit comments

Comments
 (0)