@@ -15,7 +15,6 @@ def _check_arg_length(fname, args, max_fname_arg_count, compat_args):
15
15
Checks whether 'args' has length of at most 'compat_args'. Raises
16
16
a TypeError if that is not the case, similar to in Python when a
17
17
function is called with too many arguments.
18
-
19
18
"""
20
19
if max_fname_arg_count < 0 :
21
20
raise ValueError ("'max_fname_arg_count' must be non-negative" )
@@ -38,7 +37,6 @@ def _check_for_default_values(fname, arg_val_dict, compat_args):
38
37
39
38
Note that this function is to be called only when it has been
40
39
checked that arg_val_dict.keys() is a subset of compat_args
41
-
42
40
"""
43
41
for key in arg_val_dict :
44
42
# try checking equality directly with '=' operator,
@@ -65,11 +63,8 @@ def _check_for_default_values(fname, arg_val_dict, compat_args):
65
63
66
64
if not match :
67
65
raise ValueError (
68
- (
69
- f"the '{ key } ' parameter is not "
70
- "supported in the pandas "
71
- f"implementation of { fname } ()"
72
- )
66
+ f"the '{ key } ' parameter is not supported in "
67
+ f"the pandas implementation of { fname } ()"
73
68
)
74
69
75
70
@@ -79,19 +74,18 @@ def validate_args(fname, args, max_fname_arg_count, compat_args):
79
74
has at most `len(compat_args)` arguments and whether or not all of these
80
75
elements in `args` are set to their default values.
81
76
82
- fname: str
77
+ Parameters
78
+ ----------
79
+ fname : str
83
80
The name of the function being passed the `*args` parameter
84
-
85
- args: tuple
81
+ args : tuple
86
82
The `*args` parameter passed into a function
87
-
88
- max_fname_arg_count: int
83
+ max_fname_arg_count : int
89
84
The maximum number of arguments that the function `fname`
90
85
can accept, excluding those in `args`. Used for displaying
91
86
appropriate error messages. Must be non-negative.
92
-
93
- compat_args: OrderedDict
94
- A ordered dictionary of keys and their associated default values.
87
+ compat_args : Dict
88
+ An ordered dictionary of keys and their associated default values.
95
89
In order to accommodate buggy behaviour in some versions of `numpy`,
96
90
where a signature displayed keyword arguments but then passed those
97
91
arguments **positionally** internally when calling downstream
@@ -101,10 +95,11 @@ def validate_args(fname, args, max_fname_arg_count, compat_args):
101
95
102
96
Raises
103
97
------
104
- TypeError if `args` contains more values than there are `compat_args`
105
- ValueError if `args` contains values that do not correspond to those
106
- of the default values specified in `compat_args`
107
-
98
+ TypeError
99
+ If `args` contains more values than there are `compat_args`
100
+ ValueError
101
+ If `args` contains values that do not correspond to those
102
+ of the default values specified in `compat_args`
108
103
"""
109
104
_check_arg_length (fname , args , max_fname_arg_count , compat_args )
110
105
@@ -119,7 +114,6 @@ def _check_for_invalid_keys(fname, kwargs, compat_args):
119
114
"""
120
115
Checks whether 'kwargs' contains any keys that are not
121
116
in 'compat_args' and raises a TypeError if there is one.
122
-
123
117
"""
124
118
# set(dict) --> set of the dictionary's keys
125
119
diff = set (kwargs ) - set (compat_args )
@@ -139,12 +133,10 @@ def validate_kwargs(fname, kwargs, compat_args):
139
133
140
134
Parameters
141
135
----------
142
- fname: str
136
+ fname : str
143
137
The name of the function being passed the `**kwargs` parameter
144
-
145
- kwargs: dict
138
+ kwargs : dict
146
139
The `**kwargs` parameter passed into `fname`
147
-
148
140
compat_args: dict
149
141
A dictionary of keys that `kwargs` is allowed to have and their
150
142
associated default values
@@ -154,7 +146,6 @@ def validate_kwargs(fname, kwargs, compat_args):
154
146
TypeError if `kwargs` contains keys not in `compat_args`
155
147
ValueError if `kwargs` contains keys in `compat_args` that do not
156
148
map to the default values specified in `compat_args`
157
-
158
149
"""
159
150
kwds = kwargs .copy ()
160
151
_check_for_invalid_keys (fname , kwargs , compat_args )
@@ -171,18 +162,14 @@ def validate_args_and_kwargs(fname, args, kwargs, max_fname_arg_count, compat_ar
171
162
----------
172
163
fname: str
173
164
The name of the function being passed the `**kwargs` parameter
174
-
175
165
args: tuple
176
166
The `*args` parameter passed into a function
177
-
178
167
kwargs: dict
179
168
The `**kwargs` parameter passed into `fname`
180
-
181
169
max_fname_arg_count: int
182
170
The minimum number of arguments that the function `fname`
183
171
requires, excluding those in `args`. Used for displaying
184
172
appropriate error messages. Must be non-negative.
185
-
186
173
compat_args: OrderedDict
187
174
A ordered dictionary of keys that `kwargs` is allowed to
188
175
have and their associated default values. Note that if there
0 commit comments