Skip to content

Commit

Permalink
expose use_predicted_traffic in tyr
Browse files Browse the repository at this point in the history
  • Loading branch information
xlqian committed Nov 6, 2024
1 parent 5a2c592 commit 9a5a8e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/tyr/tyr/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def format(self, value):
'additional_parameters': fields.Raw,
'co2_emission_car_value': fields.Raw,
'co2_emission_car_unit': fields.Raw,
'use_predicted_traffic': fields.Boolean,
}

api_fields = {'id': fields.Raw, 'name': fields.Raw}
Expand Down
9 changes: 9 additions & 0 deletions source/tyr/tyr/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,14 @@ def put(self, version=0, id=None, name=None):
default=instance.co2_emission_car_unit,
)

parser.add_argument(
'use_predicted_traffic',
type=inputs.boolean,
help='whether or not use predicted traffic',
location=('json', 'values'),
default=instance.use_predicted_traffic,
)

args = parser.parse_args()

try:
Expand Down Expand Up @@ -1098,6 +1106,7 @@ def map_args_to_instance(attr_name):
'additional_parameters',
'co2_emission_car_value',
'co2_emission_car_unit',
'use_predicted_traffic',
],
),
maxlen=0,
Expand Down

0 comments on commit 9a5a8e1

Please sign in to comment.