Explorar el Código

Fix schema typing (#396)

This PR changes the expected type of schema from BaseModel instance to BaseModel class because that is how it is used.

Co-authored-by: Michael Diskin <yhn112@users.noreply.github.com>
justheuristic hace 3 años
padre
commit
40d3ecebff
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      hivemind/dht/schema.py

+ 1 - 1
hivemind/dht/schema.py

@@ -18,7 +18,7 @@ class SchemaValidator(RecordValidatorBase):
     This allows to enforce types, min/max values, require a subkey to contain a public key, etc.
     """
 
-    def __init__(self, schema: pydantic.BaseModel, *, allow_extra_keys: bool = True, prefix: Optional[str] = None):
+    def __init__(self, schema: Type[pydantic.BaseModel], allow_extra_keys: bool = True, prefix: Optional[str] = None):
         """
         :param schema: The Pydantic model (a subclass of pydantic.BaseModel).