Skip to content

Commit bc3e46f

Browse files
committed
Converted type hints to ensure Python 3.7 compatibility
1 parent 4b3367e commit bc3e46f

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
def parse(val: str) -> list[str]:
1+
from typing import List
2+
3+
def parse(val: str) -> List[str]:
24
if not val : return []
35
return [item.strip() for item in val.split(',') if item.strip()]

remove-json-keys/src/remove_json_keys/lib/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse, re, sys
22
from types import SimpleNamespace as sn
3+
from typing import Optional
34

45
from . import data, init, log, string, url
56

@@ -30,7 +31,7 @@
3031
args=['-W'], action='store_true', default=None)
3132
)
3233

33-
def get_canonical_key(key: str) -> str | None:
34+
def get_canonical_key(key: str) -> Optional[str]:
3435
if key.startswith('-'): # convert CLI arg to full key name
3536
for ctrl_key, ctrl in vars(controls).items():
3637
if key in getattr(ctrl, 'args', []):
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
def parse(val: str) -> list[str]:
1+
from typing import List
2+
3+
def parse(val: str) -> List[str]:
24
if not val : return []
35
return [item.strip() for item in val.split(',') if item.strip()]

translate-messages/src/translate_messages/lib/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse, re, sys
22
from types import SimpleNamespace as sn
3+
from typing import Optional
34

45
from . import data, init, log, string, url
56

@@ -40,7 +41,7 @@
4041
args=['-W'], action='store_true', default=None)
4142
)
4243

43-
def get_canonical_key(key: str) -> str | None:
44+
def get_canonical_key(key: str) -> Optional[str]:
4445
if key.startswith('-'): # convert CLI arg to full key name
4546
for ctrl_key, ctrl in vars(controls).items():
4647
if key in getattr(ctrl, 'args', []):

0 commit comments

Comments
 (0)