Skip to content

Commit

Permalink
Merge pull request marcwebbie#127 from ereisinger/master
Browse files Browse the repository at this point in the history
requirements updated to latest available versions.
  • Loading branch information
marcwebbie authored Mar 27, 2024
2 parents 421c40a + 9723085 commit d7b9b05
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.6.1
current_version = 1.6.2
commit = True
tag = False

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@
/Vagrantfile
/.vagrant/*
/.pytest_cache/*
/venv/
/venv_test/
2 changes: 1 addition & 1 deletion passpie/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .validators import validate_config, validate_cols, validate_remote


__version__ = "1.6.1"
__version__ = "1.6.2"
pass_db = click.make_pass_decorator(Database, ensure=False)
logging.basicConfig(format="[%(levelname)s:passpie.%(module)s]: %(message)s")

Expand Down
2 changes: 1 addition & 1 deletion passpie/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def read(path, filename='.config'):
path = os.path.join(path, '.config')
with open(path) as config_file:
content = config_file.read()
configuration = yaml.load(content)
configuration = yaml.full_load(content)
except IOError:
logging.debug(u'config file "{}" not found'.format(path))
return {}
Expand Down
32 changes: 16 additions & 16 deletions passpie/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def read(self):
for filename in filenames:
docpath = os.path.join(rootdir, filename)
with open(docpath) as f:
elements.append(yaml.load(f.read()))
elements.append(yaml.full_load(f.read()))

return {"_default":
{idx: elem for idx, elem in enumerate(elements, start=1)}}
Expand Down Expand Up @@ -73,11 +73,11 @@ def filename(self, fullname):

def credential(self, fullname):
login, name = split_fullname(fullname)
Credential = Query()
credential = Query()
if login is None:
creds = self.get(Credential.name == name)
creds = self.get(credential.name == name)
else:
creds = self.get((Credential.login == login) & (Credential.name == name))
creds = self.get((credential.login == login) & (credential.name == name))
return creds

def add(self, fullname, password, comment):
Expand All @@ -98,33 +98,33 @@ def update(self, fullname, values):
login, name = split_fullname(fullname)
values['fullname'] = make_fullname(values["login"], values["name"])
values['modified'] = datetime.now()
Credential = Query()
credential = Query()
if login is None:
query = (Credential.name == name)
query = (credential.name == name)
else:
query = ((Credential.login == login) & (Credential.name == name))
self.table().update(values, query)
query = ((credential.login == login) & (credential.name == name))
self.table(self.default_table_name).update(values, query)

def credentials(self, fullname=None):
if fullname:
login, name = split_fullname(fullname)
Credential = Query()
credential = Query()
if login is None:
creds = self.search(Credential.name == name)
creds = self.search(credential.name == name)
else:
creds = self.search((Credential.login == login) & (Credential.name == name))
creds = self.search((credential.login == login) & (credential.name == name))
else:
creds = self.all()
return sorted(creds, key=lambda x: x["name"] + x["login"])

def remove(self, fullname):
self.table().remove(where('fullname') == fullname)
self.table(self.default_table_name).remove(where('fullname') == fullname)

def matches(self, regex):
Credential = Query()
credential = Query()
credentials = self.search(
Credential.name.matches(regex) |
Credential.login.matches(regex) |
Credential.comment.matches(regex)
credential.name.matches(regex) |
credential.login.matches(regex) |
credential.comment.matches(regex)
)
return sorted(credentials, key=lambda x: x["name"] + x["login"])
4 changes: 2 additions & 2 deletions passpie/importers/default_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def match(self, filepath):
return False

try:
dict_content = yaml.load(file_content)
dict_content = yaml.full_load(file_content)
except (ReaderError, ScannerError):
return False

Expand All @@ -30,6 +30,6 @@ def match(self, filepath):
def handle(self, filepath):
with open(filepath) as fp:
file_content = fp.read()
dict_content = yaml.load(file_content)
dict_content = yaml.full_load(file_content)
credentials = dict_content.get('credentials')
return credentials
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
description-file = README.rst
description_file = README.rst

[bdist_wheel]
universal = 1
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from distutils.core import setup, Command, find_packages


__version__ = "1.6.1"
__version__ = "1.6.2"

with io.open('README.rst', encoding='utf-8') as readme_file:
long_description = readme_file.read() + "\n\n"
Expand All @@ -23,11 +23,11 @@


requirements = [
'click==6.7',
'PyYAML==3.12',
'tabulate==0.8.2',
'tinydb==3.9.0',
'rstr==2.2.6',
'click==8.1.7',
'PyYAML==6.0.1',
'tabulate==0.9.0',
'tinydb==4.8.0',
'rstr==3.2.2',
]


Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_something(cli_runner):
mocker.patch('passpie.cli.ensure_dependencies')
mocker.patch('passpie.database.Repository')
init_kwargs = {}
marker = request.node.get_marker('runner_setup')
marker = request.node.add_marker('runner_setup')
if marker:
init_kwargs = marker.kwargs
return CliRunner(**init_kwargs)
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def test_update_credentials_with_interactive_open_cred_in_editor(mocker, creds,
assert mock_click_edit.called is True
mock_click_edit.assert_called_once_with(filename=filename)


def test_update_credentials_encrypt_password(mocker, creds, mock_config, irunner):
credentials = creds.make(2)
fullname = credentials[0]['fullname']
Expand Down
4 changes: 2 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def test_config_read_opens_path_and_load_yaml_content(mocker, mock_open):
mock_yaml = mocker.patch('passpie.config.yaml')

passpie.config.read('path')
assert mock_yaml.load.called
mock_yaml.load.assert_called_once_with(config_file().__enter__().read())
assert mock_yaml.full_load.called
mock_yaml.full_load.assert_called_once_with(config_file().__enter__().read())


def test_config_read_logs_debug_when_config_file_not_found_and_returns_empty(mocker):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_genpass_generates_a_password_with_length_32(mocker):


def test_genpass_raises_value_error_when_regex_pattern_error(mocker):
mocker.patch('passpie.utils.rstr.xeger', side_effect=re.error)
mocker.patch('passpie.utils.rstr.xeger', side_effect=re.error('regex pattern error'))
with pytest.raises(ValueError):
genpass("\w{32}")

Expand Down

0 comments on commit d7b9b05

Please sign in to comment.