diff --git a/jupyter_events/validators.py b/jupyter_events/validators.py index 72881ef..bd7a161 100644 --- a/jupyter_events/validators.py +++ b/jupyter_events/validators.py @@ -61,7 +61,7 @@ def validate_schema(schema: dict[str, Any]) -> None: try: # If the `version` attribute is an integer, coerce to string. # TODO: remove this in a future version. - if "version" in schema and type(schema["version"]) == int: + if "version" in schema and isinstance(schema["version"], int): schema["version"] = str(schema["version"]) msg = ( "The `version` property of an event schema must be a string. " @@ -69,7 +69,7 @@ def validate_schema(schema: dict[str, Any]) -> None: "library, it will fail to validate. Please update schema: " f"{schema['$id']}" ) - warnings.warn(JupyterEventsVersionWarning(msg)) + warnings.warn(JupyterEventsVersionWarning(msg), stacklevel=2) # Validate the schema against Jupyter Events metaschema. JUPYTER_EVENTS_SCHEMA_VALIDATOR.validate(schema) except ValidationError as err: