a
    J5dN                     @   s   d dl mZ ddlmZ dddZdddZdd	d
ZeddddddZeddddd Zeddddd Z	eddddddZ
eddddd Zeddddd ZdS )     )
deprecated   )modelsNc                 C   s:   t | }t|||dW  d   S 1 s,0    Y  dS )a  Load a problem at the given filepath.

    :param str filepath: path to a TSPLIB problem file
    :param type problem_class: special/custom problem class
    :param callable special: special/custom distance function
    :return: problem instance
    :rtype: :class:`~Problem`
    specialproblem_classN)openread)filepathr   r   f r   L/var/www/html/django/DPS/env/lib/python3.9/site-packages/tsplib95/loaders.pyload   s    	
r   c                 C   s   t |  ||dS )a  Read a problem from a file-like object.

    :param file f: file-like object
    :param type problem_class: special/custom problem class
    :param callable special: special/custom distance function
    :return: problem instance
    :rtype: :class:`~Problem`
    r   )parser	   )r   r   r   r   r   r   r	      s    	r	   c                 C   s   |pt j}|j| |dS )a  Load a problem from raw text.

    :param str text: text of a TSPLIB problem
    :param type problem_class: special/custom problem class
    :param callable special: special/custom distance function
    :return: problem instance
    :rtype: :class:`~Problem`
    r   )r   ZStandardProblemr   )textr   r   ZProblemr   r   r   r       s    	
r   z7.0.0z?Will be removed in newer versions. Use `tsplib95.load` instead.)versionreasonc                 C   s   t | |dS )zLoad a problem at the given filepath.

    :param str filepath: path to a TSPLIB problem file
    :param callable special: special/custom distance function
    :return: problem instance
    :rtype: :class:`~Problem`
    r   r   )r
   r   r   r   r   load_problem4   s    r   c                 C   s   t | S )zLoad a solution at the given filepath.

    :param str filepath: path to a TSPLIB solution file
    :return: solution instance
    :rtype: :class:`~Solution`
    r   r
   r   r   r   load_solutionC   s    r   c                 C   s   t | S )zLoad any TSPLIB file.

    This is particularly useful when you do not know in advance
    whether the file contains a problem or a solution.

    :param str filepath: path to a TSPLIB problem file
    :return: either a problem or solution instance
    r   r   r   r   r   load_unknownQ   s    r   z@Will be removed in newer versions. Use `tsplib95.parse` instead.c                 C   s   t | |dS )zLoad a problem from raw text.

    :param str text: text of a TSPLIB problem
    :param callable special: special/custom distance function
    :return: problem instance
    :rtype: :class:`~Problem`
    r   r   )r   r   r   r   r   load_problem_fromstringa   s    r   c                 C   s   t | S )zLoad a solution from raw text.

    :param str text: text of a TSPLIB solution
    :return: solution instance
    :rtype: :class:`~Solution`
    r   r   r   r   r   load_solution_fromstringp   s    r   c                 C   s   t | S )a  Load any problem/solution from raw text.

    This is particularly useful when you do not know in advance
    whether the file contains a problem or a solution.

    :param str text: text of a TSPLIB problem/solution
    :return: either a problem or solution instance
    r   r   r   r   r   load_unknown_fromstring~   s    r   )NN)NN)NN)N)N)Zdeprecated.sphinxr    r   r   r	   r   r   r   r   r   r   r   r   r   r   r   <module>   sD   







