You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would certainly improve the codebase's readability and working with the packages easier. I'm interested in working on this and adding type hints wherever applicable.
Before I proceed, I wanted to check if there are any specific guidelines or conventions for adding type hints in the project. Additionally, I would appreciate any guidance or considerations you might have regarding the use of type hints and dataclasses.
Please let me know your thoughts on this, and if there's anything specific I should keep in mind while working on this issue. Thank you!
For return types, we want simple dataclasses that support both dot notation (e.g. obj.property) and bracket notation (e.g. obj["property"]) to combine the features of namespaces and dictionaries with type hints.
Here is an example from ChatGPT:
fromdataclassesimportdataclass, fieldfromtypingimportAny@dataclassclassExtendedDataClass:
attribute1: str=field(default="")
attribute2: int=field(default=0)
def__getitem__(self, key: str) ->Any:
returnself.__dict__[key]
def__setitem__(self, key: str, value: Any) ->None:
self.__dict__[key] =value# Example usageobj=ExtendedDataClass(attribute1="value1", attribute2=42)
# Accessing attributesprint(obj.attribute1) # Using dot notationprint(obj["attribute1"]) # Using bracket notation# Setting attributesobj.attribute1="new_value1"# Using dot notationobj["attribute2"] =84# Using bracket notationprint(obj.attribute1)
print(obj.attribute2)
Perhaps we can use some new Python features like type hints (in 3.5) and dataclasses (in 3.7).
Some examples of where this would be nice:
options
dictionary forcreate_data_set
in the zos-files SDKsubmit_job
in the zos-jobs SDKThe text was updated successfully, but these errors were encountered: