fix how regex inserts underscore in function names with '2d' and '3d'
This commit is contained in:
parent
96d620382c
commit
32cc42dab3
3 changed files with 13 additions and 13 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
from pathlib import Path
|
||||
from raylib import rl, ffi
|
||||
from pyray import _underscore
|
||||
from inspect import ismethod, getmembers, isbuiltin
|
||||
import inflection, sys, json
|
||||
|
||||
|
@ -69,7 +70,7 @@ print("""from typing import Any
|
|||
reserved_words = ("in", "list", "tuple", "set", "dict", "from", "range", "min", "max", "any", "all", "len")
|
||||
|
||||
for name, attr in getmembers(rl):
|
||||
uname = inflection.underscore(name).replace('3_d', '_3d').replace('2_d', '_2d')
|
||||
uname = _underscore(name)
|
||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
||||
json_object = known_functions.get(name, None)
|
||||
if json_object is None:
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -2120,16 +2120,16 @@ def vector2_clamp(v: Vector2,min_1: Vector2,max_2: Vector2,) -> Vector2:
|
|||
def vector2_clamp_value(v: Vector2,min_1: float,max_2: float,) -> Vector2:
|
||||
""""""
|
||||
...
|
||||
def vector_2distance(v1: Vector2,v2: Vector2,) -> float:
|
||||
def vector2_distance(v1: Vector2,v2: Vector2,) -> float:
|
||||
""""""
|
||||
...
|
||||
def vector_2distance_sqr(v1: Vector2,v2: Vector2,) -> float:
|
||||
def vector2_distance_sqr(v1: Vector2,v2: Vector2,) -> float:
|
||||
""""""
|
||||
...
|
||||
def vector_2divide(v1: Vector2,v2: Vector2,) -> Vector2:
|
||||
def vector2_divide(v1: Vector2,v2: Vector2,) -> Vector2:
|
||||
""""""
|
||||
...
|
||||
def vector_2dot_product(v1: Vector2,v2: Vector2,) -> float:
|
||||
def vector2_dot_product(v1: Vector2,v2: Vector2,) -> float:
|
||||
""""""
|
||||
...
|
||||
def vector2_equals(p: Vector2,q: Vector2,) -> int:
|
||||
|
@ -2219,16 +2219,16 @@ def vector3_cross_product(v1: Vector3,v2: Vector3,) -> Vector3:
|
|||
def vector3_cubic_hermite(v1: Vector3,tangent1: Vector3,v2: Vector3,tangent2: Vector3,amount: float,) -> Vector3:
|
||||
""""""
|
||||
...
|
||||
def vector_3distance(v1: Vector3,v2: Vector3,) -> float:
|
||||
def vector3_distance(v1: Vector3,v2: Vector3,) -> float:
|
||||
""""""
|
||||
...
|
||||
def vector_3distance_sqr(v1: Vector3,v2: Vector3,) -> float:
|
||||
def vector3_distance_sqr(v1: Vector3,v2: Vector3,) -> float:
|
||||
""""""
|
||||
...
|
||||
def vector_3divide(v1: Vector3,v2: Vector3,) -> Vector3:
|
||||
def vector3_divide(v1: Vector3,v2: Vector3,) -> Vector3:
|
||||
""""""
|
||||
...
|
||||
def vector_3dot_product(v1: Vector3,v2: Vector3,) -> float:
|
||||
def vector3_dot_product(v1: Vector3,v2: Vector3,) -> float:
|
||||
""""""
|
||||
...
|
||||
def vector3_equals(p: Vector3,q: Vector3,) -> int:
|
||||
|
|
Reference in a new issue