Skip to content

fix how regex inserts underscore in function names with '2d' and '3d' #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 88 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
271c6e1
latest raylib version
electronstudio Sep 20, 2024
a48757b
add libwayland-dev
electronstudio Sep 20, 2024
9b81a6d
update headers
electronstudio Sep 20, 2024
6b7cffe
add libxkbcommon-dev
electronstudio Sep 20, 2024
0a0ceea
sdl
electronstudio Sep 20, 2024
dd9916a
sdl dl
electronstudio Sep 20, 2024
0bf42b2
sdl dl
electronstudio Sep 20, 2024
dad0621
sdl2 link flags
electronstudio Sep 20, 2024
a9f2884
remove glfw header
electronstudio Sep 24, 2024
216c469
try static sdl build
electronstudio Sep 24, 2024
8db9563
try to set fpic
electronstudio Sep 24, 2024
957584a
install alsa etc before building sdl
electronstudio Sep 24, 2024
55a0d15
windows
electronstudio Oct 9, 2024
4a787f1
fix
electronstudio Oct 9, 2024
c12365d
try
electronstudio Oct 11, 2024
452881e
try
electronstudio Oct 11, 2024
d8647da
try
electronstudio Oct 11, 2024
7323343
try
electronstudio Oct 11, 2024
ecc3c08
try
electronstudio Oct 11, 2024
6286a2c
try
electronstudio Oct 11, 2024
e2f8b4f
try
electronstudio Oct 11, 2024
d693a84
try
electronstudio Oct 11, 2024
b3d05ef
try
electronstudio Oct 11, 2024
edb2d55
try
electronstudio Oct 11, 2024
d033004
try
electronstudio Oct 11, 2024
ea4b0a0
try
electronstudio Oct 12, 2024
ac5b6b9
try
electronstudio Oct 12, 2024
192d203
try mac
electronstudio Oct 13, 2024
9d14fbf
try mac
electronstudio Oct 13, 2024
19ab15d
try mac
electronstudio Oct 13, 2024
22f624d
try mac
electronstudio Oct 13, 2024
fb417db
try
electronstudio Oct 14, 2024
5fc35c9
try
electronstudio Oct 14, 2024
7793b05
try
electronstudio Oct 14, 2024
cbdba24
try
electronstudio Oct 14, 2024
4c4c17d
try
electronstudio Oct 15, 2024
730c9d4
try
electronstudio Oct 15, 2024
2ffd224
try
electronstudio Oct 15, 2024
467263a
try
electronstudio Oct 15, 2024
65f89be
try
electronstudio Oct 15, 2024
c98bdcd
try
electronstudio Oct 15, 2024
a5cb5ab
try
electronstudio Oct 15, 2024
afa5ae9
try
electronstudio Oct 15, 2024
30913ef
try
electronstudio Oct 15, 2024
7f05708
try
electronstudio Oct 15, 2024
e692b7c
try
electronstudio Oct 15, 2024
1f17235
try
electronstudio Oct 15, 2024
1b73f0f
try
electronstudio Oct 15, 2024
05e71ea
try
electronstudio Oct 15, 2024
3b0238c
try
electronstudio Oct 15, 2024
05c455b
try
electronstudio Oct 15, 2024
35c457e
try
electronstudio Oct 15, 2024
7e2da77
try
electronstudio Oct 15, 2024
10692d5
try
electronstudio Oct 15, 2024
05ada5f
try
electronstudio Oct 15, 2024
391e600
try
electronstudio Oct 15, 2024
3314597
try
electronstudio Oct 15, 2024
7899b51
try
electronstudio Oct 15, 2024
a11016b
try
electronstudio Oct 15, 2024
447b174
try
electronstudio Oct 15, 2024
0bf9138
try
electronstudio Oct 15, 2024
3c7289c
try
electronstudio Oct 15, 2024
cadf3d1
try
electronstudio Oct 15, 2024
b14d0a2
try
electronstudio Oct 15, 2024
29f5f42
try
electronstudio Oct 16, 2024
b8231d2
try
electronstudio Oct 16, 2024
fb3f3f9
try
electronstudio Oct 16, 2024
b3ff23e
try
electronstudio Oct 16, 2024
2154d36
update raylib
electronstudio Oct 16, 2024
b0da316
try
electronstudio Oct 16, 2024
d17d3ab
try
electronstudio Oct 16, 2024
3269b0c
try
electronstudio Oct 16, 2024
adbcdce
try
electronstudio Oct 16, 2024
4670e27
try
electronstudio Oct 16, 2024
62ff73d
try
electronstudio Oct 16, 2024
be6cf57
try
electronstudio Oct 16, 2024
5dafa4e
try
electronstudio Oct 16, 2024
e97135e
try
electronstudio Oct 16, 2024
9683c57
try
electronstudio Oct 16, 2024
3d8f36e
try
electronstudio Oct 16, 2024
509771f
try
electronstudio Oct 16, 2024
e01bdb3
try
electronstudio Oct 17, 2024
cfad3ea
try
electronstudio Oct 17, 2024
1817fec
try
electronstudio Oct 17, 2024
96d6203
Merge branch 'master' into sdl
electronstudio Oct 24, 2024
32cc42d
fix how regex inserts underscore in function names with '2d' and '3d'
electronstudio Oct 24, 2024
fc9d66e
Merge remote-tracking branch 'origin/master' into fix_underscore2
electronstudio Nov 19, 2024
0f83675
merge master
electronstudio Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion create_stub_pyray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -87,7 +88,7 @@ def ctype_to_python_type(t):
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:
Expand Down
36 changes: 18 additions & 18 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -10666,6 +10666,14 @@ <h2 id="V">V</h2>
<li><a href="pyray.html#pyray.vector2_clamp">vector2_clamp() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector2_clamp_value">vector2_clamp_value() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector2_distance">vector2_distance() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector2_distance_sqr">vector2_distance_sqr() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector2_divide">vector2_divide() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector2_dot_product">vector2_dot_product() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector2_equals">vector2_equals() (in module pyray)</a>
</li>
Expand Down Expand Up @@ -10790,6 +10798,14 @@ <h2 id="V">V</h2>
<li><a href="pyray.html#pyray.vector3_cross_product">vector3_cross_product() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_cubic_hermite">vector3_cubic_hermite() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_distance">vector3_distance() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_distance_sqr">vector3_distance_sqr() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_divide">vector3_divide() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_dot_product">vector3_dot_product() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_equals">vector3_equals() (in module pyray)</a>
</li>
Expand Down Expand Up @@ -10839,6 +10855,8 @@ <h2 id="V">V</h2>
</li>
<li><a href="pyray.html#pyray.vector3_to_float_v">vector3_to_float_v() (in module pyray)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyray.html#pyray.vector3_transform">vector3_transform() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector3_unproject">vector3_unproject() (in module pyray)</a>
Expand All @@ -10855,8 +10873,6 @@ <h2 id="V">V</h2>
</li>
<li><a href="raylib.html#raylib.Vector3Clamp">Vector3Clamp() (in module raylib)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="raylib.html#raylib.Vector3ClampValue">Vector3ClampValue() (in module raylib)</a>
</li>
<li><a href="raylib.html#raylib.Vector3CrossProduct">Vector3CrossProduct() (in module raylib)</a>
Expand Down Expand Up @@ -11018,22 +11034,6 @@ <h2 id="V">V</h2>
<li><a href="raylib.html#raylib.Vector4SubtractValue">Vector4SubtractValue() (in module raylib)</a>
</li>
<li><a href="raylib.html#raylib.Vector4Zero">Vector4Zero() (in module raylib)</a>
</li>
<li><a href="pyray.html#pyray.vector_2distance">vector_2distance() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_2distance_sqr">vector_2distance_sqr() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_2divide">vector_2divide() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_2dot_product">vector_2dot_product() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_3distance">vector_3distance() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_3distance_sqr">vector_3distance_sqr() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_3divide">vector_3divide() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.vector_3dot_product">vector_3dot_product() (in module pyray)</a>
</li>
<li><a href="pyray.html#pyray.PhysicsBodyData.velocity">velocity (pyray.PhysicsBodyData attribute)</a>

Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
96 changes: 48 additions & 48 deletions docs/pyray.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@


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("-", "_")
Expand Down Expand Up @@ -136,7 +135,7 @@ def func(*args):

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__)
Expand Down
16 changes: 8 additions & 8 deletions pyray/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2982,16 +2982,16 @@ def vector2_clamp(v: Vector2|list|tuple,min_1: Vector2|list|tuple,max_2: Vector2
def vector2_clamp_value(v: Vector2|list|tuple,min_1: float,max_2: float,) -> Vector2:
""""""
...
def vector_2distance(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> float:
def vector2_distance(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> float:
""""""
...
def vector_2distance_sqr(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> float:
def vector2_distance_sqr(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> float:
""""""
...
def vector_2divide(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> Vector2:
def vector2_divide(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> Vector2:
""""""
...
def vector_2dot_product(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> float:
def vector2_dot_product(v1: Vector2|list|tuple,v2: Vector2|list|tuple,) -> float:
""""""
...
def vector2_equals(p: Vector2|list|tuple,q: Vector2|list|tuple,) -> int:
Expand Down Expand Up @@ -3081,16 +3081,16 @@ def vector3_cross_product(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> Vec
def vector3_cubic_hermite(v1: Vector3|list|tuple,tangent1: Vector3|list|tuple,v2: Vector3|list|tuple,tangent2: Vector3|list|tuple,amount: float,) -> Vector3:
""""""
...
def vector_3distance(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> float:
def vector3_distance(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> float:
""""""
...
def vector_3distance_sqr(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> float:
def vector3_distance_sqr(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> float:
""""""
...
def vector_3divide(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> Vector3:
def vector3_divide(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> Vector3:
""""""
...
def vector_3dot_product(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> float:
def vector3_dot_product(v1: Vector3|list|tuple,v2: Vector3|list|tuple,) -> float:
""""""
...
def vector3_equals(p: Vector3|list|tuple,q: Vector3|list|tuple,) -> int:
Expand Down
2 changes: 1 addition & 1 deletion raylib/rlgl.h.modified
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API
*
* DESCRIPTION:
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0, ES 3.0)
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
*
* ADDITIONAL NOTES:
Expand Down
Loading