
    *,hF                         d dl Z d dlZd dlZd dlmZmZ d dlmZmZ d dl	m
Z
mZ ddgZdedefd	Zdedee   fd
Zdedee   fdZy)    N)ListOptional)site_packages	user_site)running_under_virtualenvvirtualenv_no_globalegg_link_path_from_sys_pathegg_link_path_from_locationraw_namereturnc                 6    t        j                  dd|       dz   S )z
    Convert a Name metadata value to a .egg-link name, by applying
    the same substitution as pkg_resources's safe_name function.
    Note: we cannot use canonicalize_name because it has a different logic.
    z[^A-Za-z0-9.]+-z	.egg-link)resub)r   s    ^/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pip/_internal/utils/egg_link.py_egg_link_namer      s     66"C2[@@    c                     t        |       }t        j                  D ]E  }t        j                  j	                  ||      }t        j                  j                  |      sC|c S  y)zJ
    Look for a .egg-link file for project name, by walking sys.path.
    N)r   syspathosjoinisfile)r   egg_link_name	path_itemegg_links       r   r	   r	      sO     #8,MXX 	77<<	=977>>(#O r   c                    g }t               r;|j                  t               t               sLt        rF|j                  t               n0t        r|j                  t               |j                  t               t        |       }|D ]E  }t        j                  j                  ||      }t        j                  j                  |      sC|c S  y)a  
    Return the path for the .egg-link file if it exists, otherwise, None.

    There's 3 scenarios:
    1) not in a virtualenv
       try to find in site.USER_SITE, then site_packages
    2) in a no-global virtualenv
       try to find in site_packages
    3) in a yes-global virtualenv
       try to find in site_packages, then site.USER_SITE
       (don't look in global location)

    For #1 and #3, there could be odd cases, where there's an egg-link in 2
    locations.

    This method will just return the first one found.
    N)
r   appendr   r   r   r   r   r   r   r   )r   sitesr   siteegglinks        r   r
   r
   '   s    $ E!]##%)LL#LL#]#"8,M '',,t]377>>'"N r   )r   r   r   typingr   r   pip._internal.locationsr   r   pip._internal.utils.virtualenvr   r   __all__strr   r	   r
    r   r   <module>r(      sl    	 	 
 ! < "!AS AS A	# 	(3- 	!# !(3- !r   