From 61f837ac2c58286324afe1e1d4f68e67fcd52484 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 29 Oct 2023 22:22:22 +0800 Subject: [PATCH] doc fix --- docs/modules/linalg.md | 11 ++++++++++- docs/modules/operator.md | 2 +- docs/retype.yml | 2 +- python/typing.py | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/modules/linalg.md b/docs/modules/linalg.md index 92e1c980..093d2e7f 100644 --- a/docs/modules/linalg.md +++ b/docs/modules/linalg.md @@ -9,7 +9,7 @@ https://github.com/blueloveTH/pocketpy/blob/main/include/typings/linalg.pyi ```python from typing import overload -from c import _StructLike +from c import _StructLike, float_p class vec2(_StructLike['vec2']): x: float @@ -19,6 +19,7 @@ class vec2(_StructLike['vec2']): def __add__(self, other: vec2) -> vec2: ... def __sub__(self, other: vec2) -> vec2: ... def __mul__(self, other: float) -> vec2: ... + def __rmul__(self, other: float) -> vec2: ... def __truediv__(self, other: float) -> vec2: ... def dot(self, other: vec2) -> float: ... def cross(self, other: vec2) -> float: ... @@ -37,6 +38,7 @@ class vec3(_StructLike['vec3']): def __add__(self, other: vec3) -> vec3: ... def __sub__(self, other: vec3) -> vec3: ... def __mul__(self, other: float) -> vec3: ... + def __rmul__(self, other: float) -> vec3: ... def __truediv__(self, other: float) -> vec3: ... def dot(self, other: vec3) -> float: ... def cross(self, other: vec3) -> float: ... @@ -54,6 +56,7 @@ class vec4(_StructLike['vec4']): def __add__(self, other: vec4) -> vec4: ... def __sub__(self, other: vec4) -> vec4: ... def __mul__(self, other: float) -> vec4: ... + def __rmul__(self, other: float) -> vec4: ... def __truediv__(self, other: float) -> vec4: ... def dot(self, other: vec4) -> float: ... def length(self) -> float: ... @@ -90,6 +93,7 @@ class mat3x3(_StructLike['mat3x3']): def __add__(self, other: mat3x3) -> mat3x3: ... def __sub__(self, other: mat3x3) -> mat3x3: ... def __mul__(self, other: float) -> mat3x3: ... + def __rmul__(self, other: float) -> mat3x3: ... def __truediv__(self, other: float) -> mat3x3: ... def __invert__(self) -> mat3x3: ... @@ -118,4 +122,9 @@ class mat3x3(_StructLike['mat3x3']): def transform_point(self, p: vec2) -> vec2: ... def transform_vector(self, v: vec2) -> vec2: ... +vec2_p = float_p +vec3_p = float_p +vec4_p = float_p +mat3x3_p = float_p + ``` diff --git a/docs/modules/operator.md b/docs/modules/operator.md index 95c21a37..02fabcca 100644 --- a/docs/modules/operator.md +++ b/docs/modules/operator.md @@ -3,7 +3,7 @@ icon: package label: operator --- -The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. +The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, `operator.add(x, y)` is equivalent to the expression `x+y`. Many function names are those used for special methods, without the double underscores. + `operator.lt(a, b)` diff --git a/docs/retype.yml b/docs/retype.yml index 4c1246d9..16a72400 100644 --- a/docs/retype.yml +++ b/docs/retype.yml @@ -3,7 +3,7 @@ output: .retype url: https://pocketpy.dev branding: title: pocketpy - label: v1.2.7 + label: v1.3.0 logo: "./static/logo.png" favicon: "./static/logo.png" meta: diff --git a/python/typing.py b/python/typing.py index c6593ffd..a0b8899d 100644 --- a/python/typing.py +++ b/python/typing.py @@ -19,6 +19,9 @@ Optional = _PLACEHOLDER Callable = _PLACEHOLDER Type = _PLACEHOLDER +Iterable = _PLACEHOLDER +Generator = _PLACEHOLDER + TypeVar = _PLACEHOLDER Self = _PLACEHOLDER