File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import inspect
4
+ import string
4
5
import sys
6
+ from inspect import isfunction
5
7
from pathlib import Path
6
8
from typing import Any
7
9
from typing import Iterator
11
13
import narwhals as nw
12
14
from narwhals .utils import remove_prefix
13
15
16
+ LOWERCASE = tuple (string .ascii_lowercase )
14
17
15
- def _is_public_method_or_property (obj : Any ) -> bool :
16
- return (
17
- (inspect .isfunction (obj ) or isinstance (obj , property ))
18
- and not obj .__name__ [0 ].isupper ()
19
- and obj .__name__ [0 ] != "_"
20
- )
18
+ if sys .version_info >= (3 , 13 ):
19
+
20
+ def _is_public_method_or_property (obj : Any ) -> bool :
21
+ return (isfunction (obj ) or isinstance (obj , property )) and obj .__name__ .startswith (
22
+ LOWERCASE
23
+ )
24
+ else :
25
+
26
+ def _is_public_method_or_property (obj : Any ) -> bool :
27
+ return (isfunction (obj ) and obj .__name__ .startswith (LOWERCASE )) or (
28
+ isinstance (obj , property ) and obj .fget .__name__ .startswith (LOWERCASE )
29
+ )
21
30
22
31
23
32
def iter_api_reference_names (tp : type [Any ]) -> Iterator [str ]:
You can’t perform that action at this time.
0 commit comments