
    dfx	                     N    d dl Z d dlmZ ddlmZmZ ddlmZ d
dZd Z	d Z
d	 Zy)    N)ConfigParser   )InvalidParserNotFound)Templatec                 X   | j                   }| j                  |d      }| j                  |      st        d|z        t	               }t
        |_        |j                  | j                  |             i }|j                         D ]  }t        ||         }|||<   |rt        d||       |j                         D ]k  \  }	}
|	j                  d      xs |j                  d      }t        |
      j                  |      }|r|st!        |	|      }|rt        d|	d|       |||   |	<   m  |S )z
        Parse given file and copy the content to a dict of dicts.

        Also, the values are rendered with jinja2 template.

    zproject.confzConfig %s does not existszSection:_zChoice: =)rootjoinpathexistsr   r   stroptionxformread_string	read_textsectionsdictprintitems
startswithr   renderquestion)source_mediumdry_runinteractivesourceproject_confconfig	variablessectionsection_dictkeyval	is_hidden_vals                ]/home/api-vastappli/venv/lib/python3.12/site-packages/make/make_project/parsers/ini_parser.pyget_varsr'      s3    F ))&.AL-8<GHH^F F
}..|<=I??$ +F7O,)	'*g|4$**, 	+HCs+Fw/A/A#/FIC=''	2D9T*j#sD1&*Igs#	++"     c                     |j                  d      rVt        j                  |dd        }t        |t              rt        | |      S t        |t              rt        | |      S t        t        | |      S )Nzjson::   )	r   jsonloads
isinstancelistquestion_from_listr   question_from_stringNotImplementedError)r   defaultvalue_json_stuffs      r&   r   r   /   sf    x(jjab!12k4(%h<<S)'+>>%%#Hl;;r(   c                 D    t        dj                  | |            }|r|S |S )Nz
{}? [{}]: )inputformat)questionreplys      r&   r0   r0   >   s&    ,%%eS12EJr(   c                    t        |      }dj                  t        |      D cg c]  \  }}dj                  |dz   |       c}}      }dj                  dj                  t	        t
        t        d|dz                           }t        dj                  | ||            }t        |xs d      }d|cxk  r|k  rn t        d	      ||dz
     S t        d	      c c}}w )
N
z{}) {}   z	([1], {})z,    z%{}? Options:
{}
Choose an option {}: r   zInvalid option)
lenjoin	enumerater6   mapr   ranger5   intr   )	r   choicessizeienamesnumbersresiress	            r&   r/   r/   E   s    w<DIIYw=OPTQxq1ua0PQE  3sE!TAX4F+G!HIG
1885'RC sxa=D44 &'' tax  &'' Qs   C
)T)r+   configparserr   errorsr   r   templater   r'   r   r0   r/    r(   r&   <module>rP      s&     % -  $N<(r(   