NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.87k stars 364 forks source link

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

Closed adisbladis closed 4 years ago

adisbladis commented 4 years ago

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