File manager - Edit - /usr/lib/mysqlsh/python-packages/mysqlsh/plugin_manager/__pycache__/repositories.cpython-39.pyc
Back
a kb�gk6 � @ s� d dl Zd dlZd dlZd dlmZmZ ddlmZ ddddd �gZ d d� Z dd d�Zddd�Zed�dd� �Z ed�ddd��Zdd� Zed�dd� �ZdS )� N)�plugin�plugin_function� )�generalz&Official MySQL Shell Plugin RepositoryzRThe official MySQL Shell Plugin Repository maintained by the MySQL Team at Oracle.z6https://cdn.mysql.com/mysql_shell/plugins_manifest.zipz*manifest/mysql-shell-plugins-manifest.json)�name�description�urlZmanifestPathc C sX d}d}| D ]F}||d�d|� dd�� d|� dd �� d|� d d�� d�7 }|d7 }q|S )z�Returns a formatted list of repositories. Args: repositories (list): A list of repositories. Returns: The formated list as string � r z>4� r z??z r �-r z ��get)�repositories�out�i�r� r �G/usr/lib/mysqlsh/python-packages/mysqlsh/plugin_manager/repositories.py�format_repository_listing. s � � r Fc C s t j�t�� d�}t j�|�� r�z@t|d�� }t�|�� d�}W d � n1 sR0 Y |W S tj y� } z>td|� dt|j �� d|j� d|j� �� | r�� W Y d}~dS d}~0 t� y� } z*td |� dt|�� �� | r� W Y d}~n d}~0 0 ng S dS ) z�Fetches the registered user repositories Args: raise_exceptions (bool): Whether exceptions are raised Returns: The registered repositories as list �plugin-repositories.jsonr r Nz"ERROR: Could not parse JSON file '�'. �, line: �, col: zERROR: Error reading file ')�os�path�joinr �get_shell_user_dir�isfile�open�json�loadr �JSONDecodeError�print�str�msg�lineno�colno�OSError)�raise_exceptions�user_repo_file_path�user_repo_file� user_repos�er r r �get_user_repositoriesB s8 �.���� �r- c C s� dd| d�}t j�t�� d�}z@t|d�� }tj||dd� W d � n1 sP0 Y W d S ty� } z,t d |� dt |�� �� |r�� W Y d}~dS d}~0 0 dS ) z�Stores the registered user repositories Args: user_repos (list): The list of raise_exceptions (bool): Whether exceptions are raised Returns: True on success zMySQL Shell Plugin Repositoriesz0.0.1)ZfileType�versionr r �w� )�indentNTzERROR: Error writing to file 'r F)r r r r r r r �dumpr'