Coverage for pass_import/managers/gorilla.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-02-26 12:11 +0000

1# -*- encoding: utf-8 -*- 

2# pass import - Passwords importer swiss army knife 

3# Copyright (C) 2017-2024 Alexandre PUJOL <alexandre@pujol.io>. 

4# 

5 

6import os 

7import re 

8 

9from pass_import.core import register_managers 

10from pass_import.formats.csv import CSV 

11 

12 

13class Gorilla(CSV): 

14 """Importer for Gorilla in CSV format.""" 

15 name = 'gorilla' 

16 url = 'https://github.com/zdia/gorilla/wiki' 

17 hexport = 'File > Export: Yes: CSV Files' 

18 himport = 'pass import gorilla file.csv' 

19 keys = { 

20 'title': 'title', 

21 'password': 'password', 

22 'login': 'user', 

23 'url': 'url', 

24 'comments': 'notes', 

25 'group': 'group' 

26 } 

27 

28 def parse(self): 

29 """Parse Gorilla CSV file.""" 

30 super().parse() 

31 for entry in self.data: 

32 group = re.sub(r'(?<=[^\\])\.', os.sep, entry.get('group', '')) 

33 entry['group'] = re.sub(r'\\.', '.', group) 

34 

35 

36register_managers(Gorilla)