+16
-0
lines changedFilter options
+16
-0
lines changed Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
26
26
import math
27
27
from operator import methodcaller
28
28
import re
29
+
import warnings
29
30
30
31
from google.protobuf import descriptor
31
32
from google.protobuf import message_factory
@@ -191,6 +192,11 @@ def __init__(
191
192
self.use_integers_for_enums = use_integers_for_enums
192
193
self.descriptor_pool = descriptor_pool
193
194
if float_precision:
195
+
warnings.warn(
196
+
'float_precision option is deprecated for json_format. '
197
+
'This will turn into error in 7.34.0, please remove it '
198
+
'before that.'
199
+
)
194
200
self.float_format = '.{}g'.format(float_precision)
195
201
else:
196
202
self.float_format = None
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
25
25
import io
26
26
import math
27
27
import re
28
+
import warnings
28
29
29
30
from google.protobuf.internal import decoder
30
31
from google.protobuf.internal import type_checkers
@@ -416,6 +417,10 @@ def __init__(
416
417
self.use_index_order = use_index_order
417
418
self.float_format = float_format
418
419
if double_format is not None:
420
+
warnings.warn(
421
+
'double_format is deprecated for text_format. This will '
422
+
'turn into error in 7.34.0, please remove it before that.'
423
+
)
419
424
self.double_format = double_format
420
425
else:
421
426
self.double_format = float_format
@@ -652,6 +657,11 @@ def PrintFieldValue(self, field, value):
652
657
out.write('false')
653
658
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_FLOAT:
654
659
if self.float_format is not None:
660
+
warnings.warn(
661
+
'float_format is deprecated for text_format. This '
662
+
'will turn into error in 7.34.0, please remove it '
663
+
'before that.'
664
+
)
655
665
out.write('{1:{0}}'.format(self.float_format, value))
656
666
else:
657
667
if math.isnan(value):
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4