hamyar_paygah.utils.text_utils ============================== .. py:module:: hamyar_paygah.utils.text_utils .. autoapi-nested-parse:: Utility functions related to text. Functions --------- .. autoapisummary:: hamyar_paygah.utils.text_utils.convert_date_to_datetime hamyar_paygah.utils.text_utils.convert_date_and_time_to_datetime hamyar_paygah.utils.text_utils.is_valid_server_address Module Contents --------------- .. py:function:: convert_date_to_datetime(date_string) Convert a Jalali date string to a Gregorian datetime object. The input must be in the format ``YYYY/MM/DD``. If ``None`` or an empty string is provided, ``None`` is returned. :param date_string: Jalali date string in ``YYYY/MM/DD`` format. :returns: A ``datetime.datetime`` object representing the corresponding Gregorian date at midnight, or ``None`` if the input is ``None`` or empty. .. py:function:: convert_date_and_time_to_datetime(date_string, time_string) Convert Jalali date and time strings to a Gregorian datetime. The date must be in ``YYYY/MM/DD`` format and the time must be in ``HH:MM`` format. If either value is ``None`` or equals ``"-"``, ``None`` is returned. :param date_string: Jalali date string in ``YYYY/MM/DD`` format. :param time_string: Jalali time string in ``HH:MM`` format. :returns: A ``datetime.datetime`` object representing the corresponding Gregorian date and time, or ``None`` if inputs are missing or marked as invalid. .. py:function:: is_valid_server_address(server_address) Check whether a server address has a valid HTTP/HTTPS URL structure. The address must: - Be a non-empty string - Use the ``http`` or ``https`` scheme - Contain a network location component (host) This function validates only the structural format of the URL. It does not verify DNS resolution or server reachability. :param server_address: Server address entered by the user. :returns: ``True`` if the address appears structurally valid, otherwise ``False``.