File: //usr/lib/python3/dist-packages/django/db/models/__pycache__/utils.cpython-310.pyc
o
�aL � @ s@ d dl Z d dlmZ dd� Zdd� Zdd� Ze �� d d
� �ZdS )� N)�
namedtuplec C s| z.t | t�r | }nt | t�r| �d�\}}||�� f}n| jj| jjf}t|�dks,J �|W S t t
fy= t d| ��w )z�
Take a model or a string of the form "app_label.ModelName" and return a
corresponding ("app_label", "modelname") tuple. If a tuple is passed in,
assume it's a valid model tuple already and return it unchanged.
�.� z`Invalid model reference '%s'. String model references must be of the form 'app_label.ModelName'.)�
isinstance�tuple�str�split�lower�_meta� app_label�
model_name�len�
ValueError�AssertionError)�model�model_tupler r � r �8/usr/lib/python3/dist-packages/django/db/models/utils.py�make_model_tuple s
���r c c s0 � | � � D ]\}}|t|�r|� n|fV qdS )zp
Generate key/value pairs for the given mapping where the values are
evaluated if they're callable.
N)�items�callable)�mapping�k�vr r r �resolve_callables s ��r c C s t | � |� S �N)�create_namedtuple_class)�names�valuesr r r �unpickle_named_row% s r c s&