Skip to content

Conversation

kan-fu
Copy link
Collaborator

@kan-fu kan-fu commented Mar 15, 2024

Fix #26

@kan-fu kan-fu force-pushed the issue-26-cancel-restart-data-product branch from 7bd3f6f to de35416 Compare March 15, 2024 18:38
@kan-fu
Copy link
Collaborator Author

kan-fu commented Mar 15, 2024

One thing that bothers me is that all the public methods in ONC class can modify the filter parameter in place. For example

params = {"deviceCode": "BPR-Folger-59",}
onc.getLocations(params)
print(params)

params will have "token" and "method" as the new key. Most of time it should not cause any issues, but in getSensorCategoryCodes (a wrapper of the scalardata service with an extra "returnOptions": "excludeScalarData" in the query parameter), the expected usage is to run it before running the scalardata service, so

params = {
    "deviceCode": "BPR-Folger-59",
    "dateFrom": "2019-11-23T00:00:00.000Z",
    "dateTo": "2019-11-23T00:01:00.000Z",
}
onc.getSensorCategoryCodes(params)
params = params | {'sensorCategoryCodes': 'warn_watcher'} # get it from the previous line
onc.getDirectByDevice(params)

will not work as expected. I force pushed a commit to fix it by using a copy of the input dict.
My question is, do users care about the immutability of this paramter? Is it worth the effort to make the filter paramter of all the public methods immutable?

@kan-fu kan-fu merged commit a47d142 into main Apr 8, 2024
@kan-fu kan-fu deleted the issue-26-cancel-restart-data-product branch April 8, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add public method to support new dataProductDelivery services.

2 participants