Skip to content

Commit afe0d9b

Browse files
committed
tweaks RoundingMode docstring and roundingmode logic
1 parent c66377e commit afe0d9b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

google/cloud/bigquery/enums.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,18 @@ class RoundingMode(enum.Enum):
364364
"""Rounding mode options that can be used when storing NUMERIC or BIGNUMERIC
365365
values.
366366
367-
* Unspecified will default to using ROUND_HALF_AWAY_FROM_ZERO.
368-
* ROUND_HALF_AWAY_FROM_ZERO rounds half values away from zero when applying
367+
ROUNDING_MODE_UNSPECIFIED: will default to using ROUND_HALF_AWAY_FROM_ZERO.
368+
369+
ROUND_HALF_AWAY_FROM_ZERO: rounds half values away from zero when applying
369370
precision and scale upon writing of NUMERIC and BIGNUMERIC values.
370-
For Scale:
371-
0 1.1, 1.2, 1.3, 1.4 => 1
371+
For Scale: 0
372+
1.1, 1.2, 1.3, 1.4 => 1
372373
1.5, 1.6, 1.7, 1.8, 1.9 => 2
373-
* ROUND_HALF_EVEN rounds half values to the nearest even value when applying
374+
375+
ROUND_HALF_EVEN: rounds half values to the nearest even value when applying
374376
precision and scale upon writing of NUMERIC and BIGNUMERIC values.
375-
For Scale:
376-
0 1.1, 1.2, 1.3, 1.4 => 1
377+
For Scale: 0
378+
1.1, 1.2, 1.3, 1.4 => 1
377379
1.5 => 2
378380
1.6, 1.7, 1.8, 1.9 => 2
379381
2.5 => 2

google/cloud/bigquery/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ def __init__(
245245
self._properties["roundingMode"] = rounding_mode.name
246246
elif isinstance(rounding_mode, str):
247247
self._properties["roundingMode"] = rounding_mode
248-
else:
249-
self._properties["roundingMode"] = None
248+
else:
249+
self._properties["roundingMode"] = None
250250
if isinstance(foreign_type_definition, str):
251251
self._properties["foreignTypeDefinition"] = foreign_type_definition
252252

0 commit comments

Comments
 (0)