o
    QDi                     @  s   d dl mZ d dlmZmZmZ d dlZddlmZ er"ddlm	Z	 ej
dd	d
G dd deZG dd deZG dd deZej
ddG dd deZG dd deZG dd deZdS )    )annotations)TYPE_CHECKINGAnyListN   )
TableError   )RowTF)kw_onlyreprc                   @  sh   e Zd ZU dZdZdZdZdZddgZde	d< 	 de	d	< 	 e
dddZddddidddidiZdS )RowErrorznRow error representation.

    A base class for all the errors related to a row of the
    tabular data.

    z	row-errorz	Row Errorz#tablez#row	List[str]cellsint
row_numberrowr	   notestrc                C  s$   dd }| |t t||j|jdS )zCreate an error from a rowc                 S     | d urt | S dS N r   v r   P/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/errors/row.py<lambda>+       z#RowError.from_row.<locals>.<lambda>)r   r   r   listmapr   r   )clsr   r   to_strr   r   r   from_row(   s   zRowError.from_row
propertiesarraytypestringr&   itemsinteger)r   	rowNumberN)r   r	   r   r   )__name__
__module____qualname____doc__r&   titledescriptiontemplatetags__annotations__classmethodr#   metadata_profile_patchr   r   r   r   r      s$   
 r   c                   @     e Zd ZdZdZdZdZdS )BlankRowErrorz	blank-rowz	Blank Rowz;This row is empty. A row should contain at least one value.z1Row at position "{rowNumber}" is completely blankNr,   r-   r.   r&   r0   r1   r2   r   r   r   r   r8   <   
    r8   c                   @  r7   )PrimaryKeyErrorzprimary-keyzPrimaryKey Errorz?Values in the primary key fields should be unique for every rowz>Row at position "{rowNumber}" violates the primary key: {note}Nr9   r   r   r   r   r;   C   r:   r;   )r
   c                   @  s   e Zd ZU dZdZdZdZded< 	 ded< 	 ded	< 	 ded
< 	 edddZ	ddddiddddidddidddiddiZ
dS )ForeignKeyErrorzforeign-keyzForeignKey ErrorzDValues in the foreign key fields should exist in the reference tablez>Row at position "{rowNumber}" violates the foreign key: {note}r   field_namesfield_cellsr   reference_namereference_field_namesr   r	   r   field_values	List[Any]c             	   C  s6   dd }| |t t||j|j|t t||||dS )z&Create an foreign-key-error from a rowc                 S  r   r   r   r   r   r   r   r   q   r   z*ForeignKeyError.from_row.<locals>.<lambda>)r   r   r   r=   r>   r?   r@   r   )r!   r   r   r=   rA   r?   r@   r"   r   r   r   r#   e   s   zForeignKeyError.from_rowr$   r%   r&   r'   r(   )
fieldNames
fieldCellsreferenceNamereferenceFieldNamesN)r   r	   r   r   r=   r   rA   rB   r?   r   r@   r   )r,   r-   r.   r&   r0   r1   r2   r4   r5   r#   r6   r   r   r   r   r<   J   s,   
 r<   c                   @  r7   )DuplicateRowErrorzduplicate-rowzDuplicate RowzThe row is duplicated.z1Row at position {rowNumber} is duplicated: {note}Nr9   r   r   r   r   rG      r:   rG   c                   @  r7   )RowConstraintErrorzrow-constraintzRow Constraintz1The value does not conform to the row constraint.z4The row at position {rowNumber} has an error: {note}Nr9   r   r   r   r   rH      r:   rH   )
__future__r   typingr   r   r   attrstabler   r	   definer   r8   r;   r<   rG   rH   r   r   r   r   <module>   s    .
=