fix how regex inserts underscore in function names with '2d' and '3d' (#149)
This commit is contained in:
parent
9e5c9b7f9f
commit
bf6d5d421c
8 changed files with 81 additions and 81 deletions
|
@ -29,9 +29,8 @@ current_module = __import__(__name__)
|
|||
|
||||
|
||||
def _underscore(word: str) -> str:
|
||||
"""
|
||||
from inflection
|
||||
"""
|
||||
word = re.sub('2D$', '_2d', word)
|
||||
word = re.sub('3D$', '_3d', word)
|
||||
word = re.sub(r"([A-Z]+)([A-Z][a-z])", r'\1_\2', word)
|
||||
word = re.sub(r"([a-z\d])([A-Z])", r'\1_\2', word)
|
||||
word = word.replace("-", "_")
|
||||
|
@ -136,7 +135,7 @@ def _make_struct_constructor_function(struct):
|
|||
|
||||
for name, attr in getmembers(rl):
|
||||
# print(name, attr)
|
||||
uname = _underscore(name).replace('3_d', '_3d').replace('2_d', '_2d')
|
||||
uname = _underscore(name)
|
||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>" or str(
|
||||
type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||
# print(attr.__call__)
|
||||
|
|
Reference in a new issue