Fix cell rewriting some more.#270
Conversation
|
by now it begs the question whats wrong with just using a metaclass, they would avoid all the rewriting and ensure subclasses will always be handled correctly |
|
Just arrived home, flake8 fails, good night. :) |
Codecov Report
@@ Coverage Diff @@
## replace-class #270 +/- ##
============================================
Coverage 100% 100%
============================================
Files 9 9
Lines 651 653 +2
Branches 134 135 +1
============================================
+ Hits 651 653 +2
Continue to review full report at Codecov.
|
|
Welcome home! cough In my defense, the code works, it's a pyflakes bug. cough |
|
Could you add the test case from #269 to test_dark_magic too please? |
Maybe, but it also adds a bunch of unknown unknowns. :| It’s hard to know what obscure edge cases we break by that. |
hynek
left a comment
There was a problem hiding this comment.
I’ll have to trust you on this one. It’s enough if one of us lacks a soul. ;)
|
I'll add the test when I get some time, it's no problem. |
|
I see you've already added it 💋 |
167: Scheduled weekly dependency update for week 46 r=mithrandi
## Updates
Here's a list of all the updates bundled in this pull request. I've added some links to make it easier for you to find all the information you need.
<table align="center">
<tr>
<td><b>attrs</b></td>
<td align="center">17.2.0</td>
<td align="center">»</td>
<td align="center">17.3.0</td>
<td>
<a href="https://pypi.python.org/pypi/attrs">PyPI</a> | <a href="https://pyup.io/changelogs/attrs/">Changelog</a> | <a href="http://www.attrs.org/">Homepage</a>
</td>
<tr>
<td><b>cryptography</b></td>
<td align="center">2.1.2</td>
<td align="center">»</td>
<td align="center">2.1.3</td>
<td>
<a href="https://pypi.python.org/pypi/cryptography">PyPI</a> | <a href="https://pyup.io/changelogs/cryptography/">Changelog</a> | <a href="https://github.com/pyca/cryptography">Repo</a>
</td>
<tr>
<td><b>hypothesis</b></td>
<td align="center">3.33.0</td>
<td align="center">»</td>
<td align="center">3.37.0</td>
<td>
<a href="https://pypi.python.org/pypi/hypothesis">PyPI</a> | <a href="https://pyup.io/changelogs/hypothesis/">Changelog</a> | <a href="https://github.com/HypothesisWorks/hypothesis/issues">Repo</a>
</td>
</tr>
</table>
## Changelogs
### attrs 17.2.0 -> 17.3.0
>### 17.3.0
>-------------------
>Backward-incompatible Changes
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>- Attributes are not defined on the class body anymore.
> This means that if you define a class ``C`` with an attribute ``x``, the class will *not* have an attribute ``x`` for introspection anymore.
> Instead of ``C.x``, use ``attr.fields(C).x`` or look at ``C.__attrs_attrs__``.
> The old behavior has been deprecated since version 16.1.
> (`253 <https://github.com/python-attrs/attrs/issues/253>`_)
>Changes
>^^^^^^^
>- ``super()`` and ``__class__`` now work on Python 3 when ``slots=True``.
> (`102 <https://github.com/python-attrs/attrs/issues/102>`_, `226 <https://github.com/python-attrs/attrs/issues/226>`_, `269 <https://github.com/python-attrs/attrs/issues/269>`_, `270 <https://github.com/python-attrs/attrs/issues/270>`_, `272 <https://github.com/python-attrs/attrs/issues/272>`_)
>- Added ``type`` argument to ``attr.ib()`` and corresponding ``type`` attribute to ``attr.Attribute``.
> This change paves the way for automatic type checking and serialization (though as of this release ``attrs`` does not make use of it).
> In Python 3.6 or higher, the value of ``attr.Attribute.type`` can alternately be set using variable type annotations
> (see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_). (`151 <https://github.com/python-attrs/attrs/issues/151>`_, `214 <https://github.com/python-attrs/attrs/issues/214>`_, `215 <https://github.com/python-attrs/attrs/issues/215>`_, `239 <https://github.com/python-attrs/attrs/issues/239>`_)
>- The combination of ``str=True`` and ``slots=True`` now works on Python 2.
> (`198 <https://github.com/python-attrs/attrs/issues/198>`_)
>- ``attr.Factory`` is hashable again. (`204
> <https://github.com/python-attrs/attrs/issues/204>`_)
>- Subclasses now can overwrite attribute definitions of their superclass.
> That means that you can -- for example -- change the default value for an attribute by redefining it.
> (`221 <https://github.com/python-attrs/attrs/issues/221>`_, `229 <https://github.com/python-attrs/attrs/issues/229>`_)
>- Added new option ``auto_attribs`` to ``attr.s`` that allows to collect annotated fields without setting them to ``attr.ib()``.
> Setting a field to an ``attr.ib()`` is still possible to supply options like validators.
> Setting it to any other value is treated like it was passed as ``attr.ib(default=value)`` -- passing an instance of ``attr.Factory`` also works as expected.
> (`262 <https://github.com/python-attrs/attrs/issues/262>`_, `277 <https://github.com/python-attrs/attrs/issues/277>`_)
>- Instances of classes created using ``attr.make_class()`` can now be pickled.
> (`282 <https://github.com/python-attrs/attrs/issues/282>`_)
>----
### hypothesis 3.33.0 -> 3.37.0
>### 3.37.0
>-------------------
>This is a deprecation release for some health check related features.
>The following are now deprecated:
>* Passing :attr:`~hypothesis.HealthCheck.exception_in_generation` to
> :attr:`~hypothesis.settings.suppress_health_check`. This no longer does
> anything even when passed - All errors that occur during data generation
> will now be immediately reraised rather than going through the health check
> mechanism.
>* Passing :attr:`~hypothesis.HealthCheck.random_module` to
> :attr:`~hypothesis.settings.suppress_health_check`. This hasn't done anything
> for a long time, but was never explicitly deprecated. Hypothesis always seeds
> the random module when running given tests, so this is no longer an error
> and suppressing it doesn't do anything.
>* Passing non-:class:`~hypothesis.HealthCheck` values in
> :attr:`~hypothesis.settings.suppress_health_check`. This was previously
> allowed but never did anything useful.
>In addition, passing a non-iterable value as :attr:`~hypothesis.settings.suppress_health_check`
>will now raise an error immediately (it would never have worked correctly, but
>it would previously have failed later). Some validation error messages have
>also been updated.
>This work was funded by `Smarkets <https://smarkets.com/>`_.
>-------------------
>### 3.36.1
>-------------------
>This is a yak shaving release, mostly concerned with our own tests.
>While :func:`~python:inspect.getfullargspec` was documented as deprecated
>in Python 3.5, it never actually emitted a warning. Our code to silence
>this (nonexistent) warning has therefore been removed.
>We now run our tests with ``DeprecationWarning`` as an error, and made some
>minor changes to our own tests as a result. This required similar upstream
>updates to :pypi:`coverage` and :pypi:`execnet` (a test-time dependency via
>:pypi:`pytest-xdist`).
>There is no user-visible change in Hypothesis itself, but we encourage you
>to consider enabling deprecations as errors in your own tests.
>-------------------
>### 3.36.0
>-------------------
>This release adds a setting to the public API, and does some internal cleanup:
>- The :attr:`~hypothesis.settings.derandomize` setting is now documented (:issue:`890`)
>- Removed - and disallowed - all 'bare excepts' in Hypothesis (:issue:`953`)
>- Documented the :attr:`~hypothesis.settings.strict` setting as deprecated, and
> updated the build so our docs always match deprecations in the code.
>-------------------
>### 3.35.0
>-------------------
>This minor release supports constraining :func:`~hypothesis.strategies.uuids`
>to generate :class:`~python:uuid.UUID`s of a particular version.
>(:issue:`721`)
>Thanks to Dion Misic for this feature.
>-------------------
>### 3.34.1
>-------------------
>This patch updates the documentation to suggest
>:func:`builds(callable) <hypothesis.strategies.builds>` instead of
>:func:`just(callable()) <hypothesis.strategies.just>`.
>-------------------
>### 3.34.0
>-------------------
>Hypothesis now emits deprecation warnings if you apply
>:func:`given <hypothesis.given>` more than once to a target.
>Applying :func:`given <hypothesis.given>` repeatedly wraps the target multiple
>times. Each wrapper will search the space of of possible parameters separately.
>This is equivalent but will be much more inefficient than doing it with a
>single call to :func:`given <hypothesis.given>`.
>For example, instead of
>``given(booleans()) given(integers())``, you could write
>``given(booleans(), integers())``
>-------------------
>### 3.33.1
>-------------------
>This is a bugfix release:
>- :func:`~hypothesis.strategies.builds` would try to infer a strategy for
> required positional arguments of the target from type hints, even if they
> had been given to :func:`~hypothesis.strategies.builds` as positional
> arguments (:issue:`946`). Now it only infers missing required arguments.
>- An internal introspection function wrongly reported ``self`` as a required
> argument for bound methods, which might also have affected
> :func:`~hypothesis.strategies.builds`. Now it knows better.
>-------------------
That's it for now!
Happy merging! 🤖
161: Scheduled weekly dependency update for week 46 r=mithrandi
## Updates
Here's a list of all the updates bundled in this pull request. I've added some links to make it easier for you to find all the information you need.
<table align="center">
<tr>
<td><b>attrs</b></td>
<td align="center">17.2.0</td>
<td align="center">»</td>
<td align="center">17.3.0</td>
<td>
<a href="https://pypi.python.org/pypi/attrs">PyPI</a> | <a href="https://pyup.io/changelogs/attrs/">Changelog</a> | <a href="http://www.attrs.org/">Homepage</a>
</td>
<tr>
<td><b>cryptography</b></td>
<td align="center">2.1.2</td>
<td align="center">»</td>
<td align="center">2.1.3</td>
<td>
<a href="https://pypi.python.org/pypi/cryptography">PyPI</a> | <a href="https://pyup.io/changelogs/cryptography/">Changelog</a> | <a href="https://github.com/pyca/cryptography">Repo</a>
</td>
<tr>
<td><b>lxml</b></td>
<td align="center">4.1.0</td>
<td align="center">»</td>
<td align="center">4.1.1</td>
<td>
<a href="https://pypi.python.org/pypi/lxml">PyPI</a> | <a href="https://pyup.io/changelogs/lxml/">Changelog</a> | <a href="http://lxml.de/">Homepage</a> | <a href="https://bugs.launchpad.net/lxml">Bugtracker</a>
</td>
<tr>
<td><b>pytz</b></td>
<td align="center">2017.2</td>
<td align="center">»</td>
<td align="center">2017.3</td>
<td>
<a href="https://pypi.python.org/pypi/pytz">PyPI</a> | <a href="http://pythonhosted.org/pytz">Homepage</a> | <a href="http://pythonhosted.org/pytz/">Docs</a>
</td>
</tr>
</table>
## Changelogs
### attrs 17.2.0 -> 17.3.0
>### 17.3.0
>-------------------
>Backward-incompatible Changes
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>- Attributes are not defined on the class body anymore.
> This means that if you define a class ``C`` with an attribute ``x``, the class will *not* have an attribute ``x`` for introspection anymore.
> Instead of ``C.x``, use ``attr.fields(C).x`` or look at ``C.__attrs_attrs__``.
> The old behavior has been deprecated since version 16.1.
> (`253 <https://github.com/python-attrs/attrs/issues/253>`_)
>Changes
>^^^^^^^
>- ``super()`` and ``__class__`` now work on Python 3 when ``slots=True``.
> (`102 <https://github.com/python-attrs/attrs/issues/102>`_, `226 <https://github.com/python-attrs/attrs/issues/226>`_, `269 <https://github.com/python-attrs/attrs/issues/269>`_, `270 <https://github.com/python-attrs/attrs/issues/270>`_, `272 <https://github.com/python-attrs/attrs/issues/272>`_)
>- Added ``type`` argument to ``attr.ib()`` and corresponding ``type`` attribute to ``attr.Attribute``.
> This change paves the way for automatic type checking and serialization (though as of this release ``attrs`` does not make use of it).
> In Python 3.6 or higher, the value of ``attr.Attribute.type`` can alternately be set using variable type annotations
> (see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_). (`151 <https://github.com/python-attrs/attrs/issues/151>`_, `214 <https://github.com/python-attrs/attrs/issues/214>`_, `215 <https://github.com/python-attrs/attrs/issues/215>`_, `239 <https://github.com/python-attrs/attrs/issues/239>`_)
>- The combination of ``str=True`` and ``slots=True`` now works on Python 2.
> (`198 <https://github.com/python-attrs/attrs/issues/198>`_)
>- ``attr.Factory`` is hashable again. (`204
> <https://github.com/python-attrs/attrs/issues/204>`_)
>- Subclasses now can overwrite attribute definitions of their superclass.
> That means that you can -- for example -- change the default value for an attribute by redefining it.
> (`221 <https://github.com/python-attrs/attrs/issues/221>`_, `229 <https://github.com/python-attrs/attrs/issues/229>`_)
>- Added new option ``auto_attribs`` to ``attr.s`` that allows to collect annotated fields without setting them to ``attr.ib()``.
> Setting a field to an ``attr.ib()`` is still possible to supply options like validators.
> Setting it to any other value is treated like it was passed as ``attr.ib(default=value)`` -- passing an instance of ``attr.Factory`` also works as expected.
> (`262 <https://github.com/python-attrs/attrs/issues/262>`_, `277 <https://github.com/python-attrs/attrs/issues/277>`_)
>- Instances of classes created using ``attr.make_class()`` can now be pickled.
> (`282 <https://github.com/python-attrs/attrs/issues/282>`_)
>----
### lxml 4.1.0 -> 4.1.1
>### 4.1.1
>==================
>* Rebuild with Cython 0.27.3 to improve support for Py3.7.
That's it for now!
Happy merging! 🤖
118: Update attrs to 17.3.0 r=mithrandi There's a new version of [attrs](https://pypi.python.org/pypi/attrs) available. You are currently using **17.2.0**. I have updated it to **17.3.0** These links might come in handy: <a href="https://pypi.python.org/pypi/attrs">PyPI</a> | <a href="https://pyup.io/changelogs/attrs/">Changelog</a> | <a href="http://www.attrs.org/">Homepage</a> ### Changelog > >### 17.3.0 >------------------- >Backward-incompatible Changes >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >- Attributes are not defined on the class body anymore. > This means that if you define a class ``C`` with an attribute ``x``, the class will *not* have an attribute ``x`` for introspection anymore. > Instead of ``C.x``, use ``attr.fields(C).x`` or look at ``C.__attrs_attrs__``. > The old behavior has been deprecated since version 16.1. > (`253 <https://github.com/python-attrs/attrs/issues/253>`_) >Changes >^^^^^^^ >- ``super()`` and ``__class__`` now work on Python 3 when ``slots=True``. > (`102 <https://github.com/python-attrs/attrs/issues/102>`_, `226 <https://github.com/python-attrs/attrs/issues/226>`_, `269 <https://github.com/python-attrs/attrs/issues/269>`_, `270 <https://github.com/python-attrs/attrs/issues/270>`_, `272 <https://github.com/python-attrs/attrs/issues/272>`_) >- Added ``type`` argument to ``attr.ib()`` and corresponding ``type`` attribute to ``attr.Attribute``. > This change paves the way for automatic type checking and serialization (though as of this release ``attrs`` does not make use of it). > In Python 3.6 or higher, the value of ``attr.Attribute.type`` can alternately be set using variable type annotations > (see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_). (`151 <https://github.com/python-attrs/attrs/issues/151>`_, `214 <https://github.com/python-attrs/attrs/issues/214>`_, `215 <https://github.com/python-attrs/attrs/issues/215>`_, `239 <https://github.com/python-attrs/attrs/issues/239>`_) >- The combination of ``str=True`` and ``slots=True`` now works on Python 2. > (`198 <https://github.com/python-attrs/attrs/issues/198>`_) >- ``attr.Factory`` is hashable again. (`204 > <https://github.com/python-attrs/attrs/issues/204>`_) >- Subclasses now can overwrite attribute definitions of their superclass. > That means that you can -- for example -- change the default value for an attribute by redefining it. > (`221 <https://github.com/python-attrs/attrs/issues/221>`_, `229 <https://github.com/python-attrs/attrs/issues/229>`_) >- Added new option ``auto_attribs`` to ``attr.s`` that allows to collect annotated fields without setting them to ``attr.ib()``. > Setting a field to an ``attr.ib()`` is still possible to supply options like validators. > Setting it to any other value is treated like it was passed as ``attr.ib(default=value)`` -- passing an instance of ``attr.Factory`` also works as expected. > (`262 <https://github.com/python-attrs/attrs/issues/262>`_, `277 <https://github.com/python-attrs/attrs/issues/277>`_) >- Instances of classes created using ``attr.make_class()`` can now be pickled. > (`282 <https://github.com/python-attrs/attrs/issues/282>`_) >---- *Got merge conflicts? Close this PR and delete the branch. I'll create a new PR for you.* Happy merging! 🤖
Don't ask.
(Actually you can ask, hope the comments are enough.)