Skip to content
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

nixops.util.ImmutableValidatedObject: Allow passing an instance of self #1333

Merged
merged 1 commit into from May 5, 2020

Conversation

@adisbladis
Copy link
Member

adisbladis commented Apr 29, 2020

This is useful for plugins or others that want to extend a class.

Consider the following code

from nixops.util import ImmutableValidatedObject

class A(ImmutableValidatedObject):
    x: int

class B(A):
    y: int

a = A(x=1)
B(a, y=1)  # Type checks both x and y
This is useful for plugins or others that want to extend a class.

Consider the following code

``` python
from nixops.util import ImmutableValidatedObject

class A(ImmutableValidatedObject):
    x: int

class B(A):
    y: int

a = A(x=1)
B(a, y=1)  # Type checks both x and y
```
@grahamc grahamc added this to In progress in kanban May 5, 2020
@grahamc grahamc merged commit 417fdd5 into NixOS:master May 5, 2020
5 of 6 checks passed
5 of 6 checks passed
parsing
Details
build
Details
black
Details
mypy
Details
mypy-ratchet mypy-ratchet
Details
coverage
Details
kanban automation moved this from In progress to Done May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
kanban
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.