Skip to content

Commit b100f85

Browse files
Xenxiaxenxia
authored andcommitted
Fix distutils remove on python 3.12
Add version to test : 3.12
1 parent 26a815f commit b100f85

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/python_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
python: ["3.7","3.8","3.9","3.10","3.11"]
17+
python: ["3.7","3.8","3.9","3.10","3.11","3.12"]
1818

1919
runs-on: ubuntu-latest
2020

templateStr/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
import re as regex
22
from typing import Any, Pattern, Tuple
3-
from distutils.util import strtobool
43
from time import strftime, localtime
54

65
from templateStr.reg import *
76
from templateStr.error import BadComparatorError, CustomFunctionReturnError, NotAListError, NotFoundVariableError, NotFoundFunctionError
87

8+
def strtobool(val):
9+
"""Convert a string representation of truth to true (1) or false (0).
10+
11+
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
12+
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
13+
'val' is anything else.
14+
"""
15+
val = val.lower()
16+
if val in ('y', 'yes', 't', 'true', 'on', '1'):
17+
return 1
18+
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
19+
return 0
20+
else:
21+
raise ValueError("invalid truth value %r" % (val,))
22+
923
class TemplateStr:
1024

1125
__functions: list

0 commit comments

Comments
 (0)