finbourne-sdk-utils 0.0.32__py3-none-any.whl → 0.0.33__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -692,48 +692,26 @@ def get_required_attributes_from_model(model_object) -> list:
692
692
  The required attributes
693
693
  """
694
694
 
695
- # Get the source code for the model
696
- model_details = inspect.getsource(model_object)
697
-
698
- # bit of cleansing to aid the regex
699
- model_details = model_details.replace('"""','')
700
- model_details = model_details.replace( r"\n","\n")
701
-
702
-
703
- required_attributes = re.findall(r'(\w+):.*?= Field\(\.\.\.,', model_details)
704
- all_attributes = re.findall(r'^\s*(\w+):', model_details, re.MULTILINE)
705
-
706
-
707
- # Set the status (required or optional) for each attribute based on whether "is None:" exists in the setter function
708
- '''
709
- Here are two examples
710
-
711
- A) A None value is not allowed and hence this is required. Notice the "if identifiers is None:" condition.
695
+ required_attributes = []
712
696
 
713
- @identifiers.setter
714
- def identifiers(self, identifiers):
715
- """Sets the identifiers of this InstrumentDefinition.
716
- A set of identifiers that can be used to identify the instrument. At least one of these must be configured to be a unique identifier. # noqa: E501
717
- :param identifiers: The identifiers of this InstrumentDefinition. # noqa: E501
718
- :type: dict(str, InstrumentIdValue)
719
- """
720
- if identifiers is None:
721
- raise ValueError("Invalid value for `identifiers`, must not be `None`") # noqa: E501
697
+ # Use pydantic's __fields__ to determine required fields
698
+ # This is more reliable than parsing source code
699
+ if hasattr(model_object, '__fields__'):
700
+ for field_name, field_info in model_object.__fields__.items():
701
+ # In Pydantic v1, required fields have field_info.required = True
702
+ if field_info.required:
703
+ required_attributes.append(field_name)
704
+ else:
705
+ # Fallback to old regex-based approach for backwards compatibility
706
+ # Get the source code for the model
707
+ model_details = inspect.getsource(model_object)
722
708
 
723
- self._identifiers = identifiers
709
+ # bit of cleansing to aid the regex
710
+ model_details = model_details.replace('"""','')
711
+ model_details = model_details.replace( r"\n","\n")
724
712
 
725
- B) A None value is allowed and hence this is optional
713
+ required_attributes = re.findall(r'(\w+):.*?= Field\(\.\.\.,', model_details)
726
714
 
727
- @look_through_portfolio_id.setter
728
- def look_through_portfolio_id(self, look_through_portfolio_id):
729
- """Sets the look_through_portfolio_id of this InstrumentDefinition.
730
- :param look_through_portfolio_id: The look_through_portfolio_id of this InstrumentDefinition. # noqa: E501
731
- :type: ResourceId
732
- """
733
-
734
- self._look_through_portfolio_id = look_through_portfolio_id
735
-
736
- '''
737
715
  return required_attributes
738
716
 
739
717
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: finbourne-sdk-utils
3
- Version: 0.0.32
3
+ Version: 0.0.33
4
4
  Summary: Python utilities for LUSID V2 SDK
5
5
  Home-page: https://github.com/finbourne/finbourne-sdk-utils
6
6
  Author: FINBOURNE Technology
@@ -11,7 +11,7 @@ finbourne_sdk_utils/cocoon/properties.py,sha256=wxGZDopWSg_hruCwADYRuWI9ZiXBvG3q
11
11
  finbourne_sdk_utils/cocoon/seed_sample_data.py,sha256=SYvuq08j8BbzE3uQMoTmS-xrNtbJ2IRg6KJ1PBm-uVI,4390
12
12
  finbourne_sdk_utils/cocoon/systemConfiguration.py,sha256=qheX-jVTaKuD34DSJn57RyTu4jlLMyXjkSYGVe8goIM,3284
13
13
  finbourne_sdk_utils/cocoon/transaction_type_upload.py,sha256=xASAzh7ycOzksW--azya-QMtgci48w4phfhyxw7v-gg,4439
14
- finbourne_sdk_utils/cocoon/utilities.py,sha256=3YNRll7OlxtCZIPlyvSyBiw9KWpLMTBI1pHCX6J6A_w,63103
14
+ finbourne_sdk_utils/cocoon/utilities.py,sha256=_WMjKbuVJdr01WZm16x8GSx-Hd-XUpJ7NdfZC3Zo5Nk,62206
15
15
  finbourne_sdk_utils/cocoon/validator.py,sha256=Cguv5O6FR4y4OtRIFrXLy7oQ_XfjHnBo9PNplYi2y_M,7381
16
16
  finbourne_sdk_utils/cocoon/config/domain_settings.json,sha256=qFcdoiNRLIBD1QNBKwvyfPSUdYLE0DgQfVk_0qH4xcs,3504
17
17
  finbourne_sdk_utils/cocoon/config/seed_sample_data.json,sha256=V7PQoe8x3TIzvnVFoSfynP9dqlo6Z_68lvLlmKxD5xc,1186
@@ -45,8 +45,8 @@ finbourne_sdk_utils/lpt/txn_config.py,sha256=4WIEzypXXuoHdbEDJLl90iZj7dYfV-KaE8d
45
45
  finbourne_sdk_utils/lpt/txn_config_yaml.py,sha256=F5kHG-7l5khJvnaLEndHurgmannCi-Pt3U6MMJRuJ9Y,17717
46
46
  finbourne_sdk_utils/pandas_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  finbourne_sdk_utils/pandas_utils/lusid_pandas.py,sha256=rJENs5lIYEKcwvYaagKc-ei_3sOnbNZT9oFLuO8PU6Y,4900
48
- finbourne_sdk_utils-0.0.32.dist-info/LICENSE,sha256=pT32QD9c76jv4OMjXhZrYpjqlZTuiex52qmKUsLKRQc,1066
49
- finbourne_sdk_utils-0.0.32.dist-info/METADATA,sha256=PLmD0Pd_HPpmGPiZli8d9M_QDDKbxBPPeeKIcaPifHw,731
50
- finbourne_sdk_utils-0.0.32.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
51
- finbourne_sdk_utils-0.0.32.dist-info/top_level.txt,sha256=DiS6bVuYtHoXKSgWOlYhiXKPVFCJqhdtmQgMCGNZxxY,29
52
- finbourne_sdk_utils-0.0.32.dist-info/RECORD,,
48
+ finbourne_sdk_utils-0.0.33.dist-info/LICENSE,sha256=pT32QD9c76jv4OMjXhZrYpjqlZTuiex52qmKUsLKRQc,1066
49
+ finbourne_sdk_utils-0.0.33.dist-info/METADATA,sha256=z1o4qEZd8G3F3zajULuZaXEy0IXmmrzJe0Of7qCPNZ4,731
50
+ finbourne_sdk_utils-0.0.33.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
51
+ finbourne_sdk_utils-0.0.33.dist-info/top_level.txt,sha256=DiS6bVuYtHoXKSgWOlYhiXKPVFCJqhdtmQgMCGNZxxY,29
52
+ finbourne_sdk_utils-0.0.33.dist-info/RECORD,,