-
Notifications
You must be signed in to change notification settings - Fork 301
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
Hashable and Immutable ParamSpec #1367
Hashable and Immutable ParamSpec #1367
Conversation
I think it could be made part of this PR to remove those two methods. |
Codecov Report
@@ Coverage Diff @@
## master #1367 +/- ##
==========================================
- Coverage 73.15% 73.11% -0.04%
==========================================
Files 79 79
Lines 9156 9144 -12
==========================================
- Hits 6698 6686 -12
Misses 2458 2458 |
Codecov Report
@@ Coverage Diff @@
## master #1367 +/- ##
==========================================
+ Coverage 73.47% 73.51% +0.03%
==========================================
Files 92 92
Lines 10239 10253 +14
==========================================
+ Hits 7523 7537 +14
Misses 2716 2716 |
hash_value = all_attr_tuple_hash | ||
|
||
# Then, XOR it with the individual hashes of all relevant attributes | ||
for attr in attrs_with_strings: |
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.
You seem to know what you are doing, but can you explain why XOR?
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.
it pops up within the first 10 google search items when you look for "creating hash in python" or similar :) and the comments there seem convincing.
The line 97. If you want a working pysweep @astafan8, do not remove those! |
Also in ~3.86 it is moved to hypothesis._strategies - private module, hence we should not use it.
Apparently it has been moved. Tested with version ~3.86
@QCoDeS/core ready for review |
Looks good but there seems to be some intermittent issue with the hypothesis generation
|
… feature/hashable_paramspec
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.
Assuming this works well with the Sweep this is ready to land
cool. may we give it an extra week? (the sweep has been updated some days ago, users have been informed, but not sure that everyone was updated) unless, this blocks the "interdependencies refactoring PR" very prominently. |
Sounds like a good idea, merging this on a Friday is probably not the best idea |
@astafan8 Should we merge this? |
Introduction of
__eq__
forParamSpec
introduced implicit__hash__ = None
definition into the class (according to Python 3 rules) which cause some rare code that was makingset
s ofParamSpec
s break.This PR adds
__hash__
method toParamSpec
that allows to create useParamSpec
s as other hashable objects, for example, making sets of them.Moreover,
ParamSpec
is made immutable.add_depends_on
andadd_inferred_from
methods have been removed.Also,
depends_on_
andinferred_from_
properties (with_
at the end) have been added which return a list of strings as opposed to a string with comma-separated names.add_depends_on
andadd_inferred_from
methods