Remove mypy union line which breaks older pythons.

Change I084336ba41147f824b92dc07235e5f19b7ac4a9c introduced mypy
syntax which breaks Python releases before 3.10. Unfortunately, for
2024.1 we commit to supporting Python back to 3.8.

Specifically, you receive this error message if you run pep8:

pep8 mypy.....................................................................Failed
pep8 - hook id: mypy
pep8 - exit code: 1
pep8
pep8 openstack/object_store/v1/_proxy.py: note: In member "generate_temp_url" of class "Proxy":
pep8 openstack/object_store/v1/_proxy.py:1049:21: error: X | Y syntax for unions requires Python 3.10  [syntax]
pep8 Found 1 error in 1 file (checked 410 source files)

I asked some buddies, and we're fairly sure that this line would
crash the runtime on Python 3.8, because its a syntax error.

So instead, let's use typing syntax compatible with other pythons.

Change-Id: I0a5f57346c7ff469ffe1b93051e470141117ada9
This commit is contained in:
Michael Still 2024-04-07 09:09:57 +10:00
parent 4d9c40b74c
commit 7131781adb
1 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import hmac
import json
import os
import time
import typing as ty
from urllib import parse
from openstack import _log
@ -1046,7 +1047,7 @@ class Proxy(proxy.Proxy):
method.upper(),
)
expiration: float | int
expiration: ty.Union[float, int]
if not absolute:
expiration = _get_expiration(timestamp)
else: