Input Source Resolver
Utility class for determining the type of input source provided to the Norman SDK. The resolver inspects the incoming data and classifies it as: InputSource.File - A local file path (string or Path) that exists. InputSource.Stream - A synchronous or asynchronous stream object. InputSource.Link - A valid HTTP or HTTPS URL. InputSource.Primitive - Any other literal or primitive value. This classification enables the SDK to handle file uploads, URLs, streams, and primitive values in a unified manner.
Methods
resolve(data) staticmethod
Determine the appropriate InputSource type for the given value.
Classification follows these rules:
Path If
datais aPathobject that exists on disk →InputSource.File.Async Stream If
dataexposes__aiter__,__anext__, and an asyncread()→InputSource.Stream.Sync Stream If
datais a file-like object or exposesread,__iter__, and__next__→InputSource.Stream.String
If it is a valid HTTP/HTTPS URL →
InputSource.Link.If it is a file path that exists →
InputSource.File.Otherwise →
InputSource.Primitive.Anything else Falls back to
InputSource.Primitive.
Parameters
data (
Any) The input object to classify. May be a string, file path, stream, or primitive value.
Returns
InputSource - The detected input source classification.
Raises
ValueError - If
dataisNone.FileNotFoundError - If a
Pathobject points to a non-existent file.