Repository navigation
Added __repr__ implementation on all locators and formators - #25767
Daniil-Aleshechkin wants to merge 33 commits into
Conversation
|
For unit testing because of the nature of the feature, any parameters that get added/ changed in anyway will be coupled to the test, can someone recommend some safe classes that I can use? |
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
|
I think an easy test is seeing if you can reproduce the locator and formatter examples (e.g. https://matplotlib.org/devdocs/gallery/ticks/tick-locators.html), but replace the titles with the reprs. |
|
This is modifying the reported runtime signature of all Formatters to have |
| tmin = ((vmin - t0) // minorstep + 1) * minorstep | ||
| tmax = ((vmax - t0) // minorstep + 1) * minorstep | ||
| locs = np.arange(tmin, tmax, minorstep) + t0 |
There was a problem hiding this comment.
This change seems unreleated, though I think it was included in a different recent PR
There was a problem hiding this comment.
Must have been an artifact when I set the branch up. I'll remove it
Yea I think I need to rebind the signature to my wrappers. Would doing something like. work? |
|
That may work, but the more standard/complete way of doing it is to use |
Gotcha I'll give that a shot |
Seems like it fixed the wrapping issue, but now I have the problem where args is added to the signature when I think I'm creating an init method for classes that don't have one defined. Not sure exactly what's going on, because I still get the same issue when I don't add anything from this commit: d3aef45 |
I figured it out after my morning run today :) Basically checking for null doesn't account for the case when we inherit an init method. My solution is I added a marker property and checked for it. I don't want to add it to the stubs though because it's only used for this. Is there a better / standard way of adding an arbitrary marker to the function? |
I think you'll want to be checking |
|
This is very nice technical work, however the Unfortunately I think the solution here is much less sophisticated and much more rote: write This does bring up the issue that there are attributes on these objects that influence how they render (and thus knowing the repr of two objects is the same is not enough to be sure that they are functionally the same), but I think that it is fair to say that is (well) out of scope. @Daniil-Aleshechkin I'm sorry we led you down this path and asked you to do a bunch of work that is not going to land in its current state 😞 |
e8f2a0a to
23d9ba9
Compare
|
Not sure exactly what's going on but is the test agent in a bad state? Only the python 3.10 agent is throwing an exception: "Traceback (most recent call last):\n File "", line 1, in \n File "/Users/runner/work/1/s/lib/matplo...ion (%s) doesn't match libtk.a version (%s)"\nRuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)\n" |
|
That's a known issue, but the other test failures are for the new tests here. |
Managed to fix those. Do we know how to fix this issue? |
|
That's up to Microsoft. |
| """ | ||
|
|
||
| def __repr__(self): | ||
| return f"{self.__class__.__name__}(base={self.base.__repr__()})" |
There was a problem hiding this comment.
These __repr__ should all be:
| return f"{self.__class__.__name__}(base={self.base.__repr__()})" | |
| return f"{self.__class__.__name__}(base={self.base!r})" |
|
ping @Daniil-Aleshechkin any bandwidth for continuing with this? |
Ah completely forgot about this. I stopped working on it cause I was blocked on that issue with the python 3.10 test runner. Did that get resolved? If so, I can resume working :) |
|
Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it. |
PR Summary
Added an init_subclass implementation on the TickerHelper class that creates a wrapper over all the subclass' init methods. I'm assuming the following:
This closes #21898
PR Checklist
Linked Issue
Documentation and Tests
pytestpasses)Release Notes
.. versionadded::directive in the docstring and documented indoc/users/next_whats_new/.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/next_whats_new/README.rstornext_api_changes/README.rst