-
Notifications
You must be signed in to change notification settings - Fork 21
Rename id to uuid in DiffractionObject
#271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1a2214f
209a194
5824250
2f293c0
ceba7f9
2d1c104
b198d66
98a3028
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| **Added:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Changed:** | ||
|
|
||
| * DiffractionObject's "id" property renamed to "uuid" | ||
|
|
||
| **Deprecated:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Removed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Fixed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Security:** | ||
|
|
||
| * <news item> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ class DiffractionObject: | |
| The array containing the quantity of q, tth, d values. | ||
| input_xtype : str | ||
| The type of the independent variable in `xarray`. Must be one of {*XQUANTITIES} | ||
| id : uuid | ||
| _uuid : uuid | ||
| The unique identifier for the diffraction object. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are marked with |
||
| scat_quantity : str | ||
| The type of scattering experiment (e.g., "x-ray", "neutron"). Default is an empty string "". | ||
|
|
@@ -127,7 +127,7 @@ def __init__( | |
| >>> print(do.metadata) | ||
| """ | ||
|
|
||
| self._id = uuid.uuid4() | ||
| self._uuid = uuid.uuid4() | ||
| self._input_data(xarray, yarray, xtype, wavelength, scat_quantity, name, metadata) | ||
|
|
||
| def _input_data(self, xarray, yarray, xtype, wavelength, scat_quantity, name, metadata): | ||
|
|
@@ -299,12 +299,12 @@ def input_xtype(self, _): | |
| raise AttributeError(_setter_wmsg("input_xtype")) | ||
|
|
||
| @property | ||
| def id(self): | ||
| return self._id | ||
| def uuid(self): | ||
| return self._uuid | ||
|
|
||
| @id.setter | ||
| def id(self, _): | ||
| raise AttributeError(_setter_wmsg("id")) | ||
| @uuid.setter | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while User still has access to |
||
| def uuid(self, _): | ||
| raise AttributeError(_setter_wmsg("uuid")) | ||
|
|
||
| def get_array_index(self, value, xtype=None): | ||
| """Return the index of the closest value in the array associated with | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are making this attribute public and giving it a getter, I wonder if we should just call it uuid and remove the underscore? What do you think? It may also be less confusing if the attribute name and how it is accessed is the szme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. It turns out we shall write a separate docstring for
@propertymethods as shown below (as done in the latest commit):This way, User does not have to read private properties starting with
_.API doc is also clearly marked with
@property: