1
1
import inspect
2
2
import operator
3
- import warnings
4
3
from collections import OrderedDict
5
4
6
5
import inflection
@@ -147,23 +146,14 @@ def undo_format_field_name(field_name):
147
146
return field_name
148
147
149
148
150
- def format_link_segment (value , format_type = None ):
149
+ def format_link_segment (value ):
151
150
"""
152
151
Takes a string value and returns it with formatted keys as set in `format_type`
153
152
or `JSON_API_FORMAT_RELATED_LINKS`.
154
153
155
154
:format_type: Either 'dasherize', 'camelize', 'capitalize' or 'underscore'
156
155
"""
157
- if format_type is None :
158
- format_type = json_api_settings .FORMAT_RELATED_LINKS
159
- else :
160
- warnings .warn (
161
- DeprecationWarning (
162
- "Using `format_type` argument is deprecated."
163
- "Use `format_value` instead."
164
- )
165
- )
166
-
156
+ format_type = json_api_settings .FORMAT_RELATED_LINKS
167
157
return format_value (value , format_type )
168
158
169
159
@@ -179,15 +169,7 @@ def undo_format_link_segment(value):
179
169
return value
180
170
181
171
182
- def format_value (value , format_type = None ):
183
- if format_type is None :
184
- warnings .warn (
185
- DeprecationWarning (
186
- "Using `format_value` without passing on `format_type` argument is deprecated."
187
- "Use `format_field_name` instead."
188
- )
189
- )
190
- format_type = json_api_settings .FORMAT_FIELD_NAMES
172
+ def format_value (value , format_type ):
191
173
if format_type == "dasherize" :
192
174
# inflection can't dasherize camelCase
193
175
value = inflection .underscore (value )
@@ -342,17 +324,6 @@ def get_default_included_resources_from_serializer(serializer):
342
324
return list (getattr (meta , "included_resources" , []))
343
325
344
326
345
- def get_included_serializers (serializer ):
346
- warnings .warn (
347
- DeprecationWarning (
348
- "Using of `get_included_serializers(serializer)` function is deprecated."
349
- "Use `serializer.included_serializers` instead."
350
- )
351
- )
352
-
353
- return getattr (serializer , "included_serializers" , dict ())
354
-
355
-
356
327
def get_relation_instance (resource_instance , source , serializer ):
357
328
try :
358
329
relation_instance = operator .attrgetter (source )(resource_instance )
0 commit comments