File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -64,3 +64,26 @@ cdef class AxisProperty:
64
64
65
65
def __set__ (self , obj , value ):
66
66
obj._set_axis(self .axis, value)
67
+
68
+
69
+ cdef class ClassProperty:
70
+ """
71
+ Property-like that can be accessed on the class and not just on an instance.
72
+ """
73
+
74
+ cdef readonly:
75
+ object func, name, __doc__
76
+
77
+ def __init__ (self , func ):
78
+ self .func = func
79
+ self .name = name
80
+ self .__doc__ = doc
81
+
82
+ def __get__ (self , obj , typ ):
83
+ return self .func(obj)
84
+
85
+ def __set__ (self , obj , value ):
86
+ raise AttributeError (" Can't set attribute" )
87
+
88
+
89
+ class_property = ClassProperty
Original file line number Diff line number Diff line change 8
8
9
9
from pandas ._typing import DtypeObj
10
10
from pandas .errors import AbstractMethodError
11
+ from pandas ._libs .properties import class_property
11
12
12
13
from pandas .core .dtypes .generic import ABCDataFrame , ABCIndexClass , ABCSeries
13
14
@@ -168,7 +169,7 @@ def kind(self) -> str:
168
169
"""
169
170
return "O"
170
171
171
- @property
172
+ @class_property
172
173
def name (self ) -> str :
173
174
"""
174
175
A string identifying the data type.
You can’t perform that action at this time.
0 commit comments