khard.helpers.typing
********************

Helper code for type annotations and runtime type conversion.


Attributes
==========

+------------+--------------------------------------------------------------------------------------------+
| "Date"     |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+
| "StrList"  |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+
| "PostAddr  |                                                                                            |
| ess"       |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+


Functions
=========

+------------+--------------------------------------------------------------------------------------------+
| "convert_  | converts user input into vCard compatible data structures                                  |
| to_vcard"  |                                                                                            |
| (…)        |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+
| "list_to_  | converts list to string recursively so that nested lists are supported                     |
| string"(→  |                                                                                            |
| str)       |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+
| "string_t  |                                                                                            |
| o_list"(→  |                                                                                            |
| list[str]) |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+
| "string_t  | Convert a date string into a date object.                                                  |
| o_date"(→  |                                                                                            |
| datetime.  |                                                                                            |
| datetime)  |                                                                                            |
+------------+--------------------------------------------------------------------------------------------+


Module Contents
===============

khard.helpers.typing.Date

khard.helpers.typing.StrList

khard.helpers.typing.PostAddress

khard.helpers.typing.convert_to_vcard(name: str, value: StrList, constraint: type[str]) -> str
khard.helpers.typing.convert_to_vcard(name: str, value: StrList, constraint: type[list]) -> list[str]
khard.helpers.typing.convert_to_vcard(name: str, value: StrList, constraint: None) -> StrList

   converts user input into vCard compatible data structures

   Parameters:
      * **name** -- object name, only required for error messages

      * **value** -- user input

      * **constraint** -- set the accepted return type for vCard
        attribute

   Returns:
      cleaned user input, ready for vCard or a ValueError

khard.helpers.typing.list_to_string(input: str | list, delimiter: str) -> str

   converts list to string recursively so that nested lists are
   supported

   Parameters:
      * **input** -- a list of strings and lists of strings (and so on
        recursive)

      * **delimiter** -- the delimiter to use when joining the items

   Returns:
      the recursively joined list

khard.helpers.typing.string_to_list(input: str | list[str], delimiter: str) -> list[str]

khard.helpers.typing.string_to_date(string: str) -> datetime.datetime

   Convert a date string into a date object.

   Parameters:
      **string** -- the date string to parse

   Returns:
      the parsed datetime object
