-
Notifications
You must be signed in to change notification settings - Fork 0
DOC: set __module__ on remaining top-level functions #2
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
base: trunk2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ from cython cimport ( | |
| from pandas._config import using_string_dtype | ||
|
|
||
| from pandas._libs.missing import check_na_tuples_nonequal | ||
| from pandas.util._decorators import set_module | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good addition of the |
||
|
|
||
| import_datetime() | ||
|
|
||
|
|
@@ -154,6 +155,7 @@ def memory_usage_of_objects(arr: object[:]) -> int64_t: | |
| # ---------------------------------------------------------------------- | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_scalar(val: object) -> bool: | ||
|
Comment on lines
+158
to
159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| """ | ||
| Return True if given object is scalar. | ||
|
|
@@ -255,6 +257,7 @@ cdef int64_t get_itemsize(object val): | |
| return -1 | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_iterator(obj: object) -> bool: | ||
|
Comment on lines
+260
to
261
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| """ | ||
| Check if the object is an iterator. | ||
|
|
@@ -1095,6 +1098,7 @@ def indices_fast(ndarray[intp_t, ndim=1] index, const int64_t[:] labels, list ke | |
|
|
||
| # core.common import for fast inference checks | ||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_float(obj: object) -> bool: | ||
|
Comment on lines
+1101
to
1102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Consider reviewing the entire file to ensure all relevant functions that should be part of the public API are decorated appropriately. If there are functions intentionally left without the decorator, it might be helpful to add a comment explaining why they are not part of the public API. |
||
| """ | ||
| Return True if given object is float. | ||
|
|
@@ -1128,6 +1132,7 @@ def is_float(obj: object) -> bool: | |
| return util.is_float_object(obj) | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_integer(obj: object) -> bool: | ||
| """ | ||
| Return True if given object is integer. | ||
|
|
@@ -1172,6 +1177,7 @@ def is_int_or_none(obj) -> bool: | |
| return obj is None or util.is_integer_object(obj) | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_bool(obj: object) -> bool: | ||
| """ | ||
| Return True if given object is boolean. | ||
|
|
@@ -1202,6 +1208,7 @@ def is_bool(obj: object) -> bool: | |
| return util.is_bool_object(obj) | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_complex(obj: object) -> bool: | ||
| """ | ||
| Return True if given object is complex. | ||
|
|
@@ -1237,6 +1244,7 @@ cpdef bint is_decimal(object obj): | |
| return isinstance(obj, Decimal) | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def is_list_like(obj: object, allow_sets: bool = True) -> bool: | ||
| """ | ||
| Check if the object is list-like. | ||
|
|
@@ -1520,6 +1528,7 @@ cdef object _try_infer_map(object dtype): | |
| return None | ||
|
|
||
|
|
||
| @set_module("pandas.api.types") | ||
| def infer_dtype(value: object, skipna: bool = True) -> str: | ||
| """ | ||
| Return a string label of the type of the elements in a list-like input. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes made here are setting the
__module__attribute for several functions to "pandas". This is a good practice for ensuring that these functions are correctly associated with the pandas package. However, we should consider using the@set_moduledecorator for consistency and maintainability.