Skip to content

Commit

Permalink
temp override needs to handle missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Carver committed Jan 16, 2024
1 parent 1011459 commit 35a961b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Werkzeug>=2.0.1
statsmodels==0.14.0
PyPDF2>=2.5.0
pyarrow>=14.0.1
scikit-learn>1.3.0
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def dir_this_file():
"statsmodels==0.14.0",
"PyPDF2>=2.5.0",
"pyarrow>=14.0.1",
"scikit-learn>1.3.0"
],
tests_require=["nose", "flake8"],
extras_require=dict(),
Expand Down
8 changes: 7 additions & 1 deletion sysdata/mongodb/mongo_temporary_override.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from syscore.exceptions import missingData
from syscore.constants import arg_not_supplied

from sysdata.production.temporary_override import temporaryOverrideData
from sysdata.mongodb.mongo_override import from_dict_to_override, from_override_to_dict
from sysobjects.production.override import Override
from sysdata.mongodb.mongo_generic import mongoDataWithSingleKey
from syslogging.logger import get_logger
from sysobjects.production.override import DEFAULT_OVERRIDE


TEMPORARY_OVERRIDE_COLLECTION = "temporary_override_collection"
KEY = "instrument_code"
Expand All @@ -27,7 +30,10 @@ def mongo_data(self):
return self._mongo_data

def get_stored_override_for_instrument(self, instrument_code: str) -> Override:
override_as_dict = self.mongo_data.get_result_dict_for_key(instrument_code)
try:
override_as_dict = self.mongo_data.get_result_dict_for_key(instrument_code)
except missingData:
return DEFAULT_OVERRIDE

return from_dict_to_override(override_as_dict)

Expand Down

0 comments on commit 35a961b

Please sign in to comment.