Skip to content

files

File related data types.

RECORDING_UPLOAD_FORMATS = (FileFormat.EDF,) module-attribute

The formats a recording may be uploaded in; the server refuses any other at registration. Served as ServerLimits.recording_formats, so a client filters its file picker and validates against the server's list instead of a copy.

FileFormat

Bases: str, Enum

Supported file formats.

from_file_name(fname) classmethod

Return the recording file type based on the file name.

If the file name does not have a recognized extension, raises ValueError.

Parameters:

Name Type Description Default
fname str | Path

The file name.

required

Returns:

Type Description
FileFormat

The FileFormat.

Examples:

>>> FileFormat.from_file_name("recording.edf")
<FileFormat.EDF: 'edf'>

FileType

Bases: str, Enum

Valid type of upload/input files.

ARCHIVES = 'archives' class-attribute instance-attribute

Archives file containing resampled or otherwise processed recording data.

EVENTS = 'events' class-attribute instance-attribute

Events file containing the event annotations and related information.

LOGS = 'logs' class-attribute instance-attribute

Logs file containing the logs of an analysis.

RECORDING = 'recording' class-attribute instance-attribute

Recording file containing the polysomnography data.

FileUploadState

Bases: str, Enum

State of a file upload.

FAILED = 'failed' class-attribute instance-attribute

The file upload has failed.

REGISTERED = 'registered' class-attribute instance-attribute

The file upload is registered but not yet started.

REJECTED = 'rejected' class-attribute instance-attribute

The file upload has been rejected, e.g., because the file format or content is invalid.

UPLOADED = 'uploaded' class-attribute instance-attribute

The file has been successfully uploaded.