From f5ba90e2cc5bb88b29b173bae11ba46e06efecf7 Mon Sep 17 00:00:00 2001 From: Holger Nahrstaedt <holgernahrstaedt@gmx.de> Date: Sat, 24 Oct 2020 14:26:02 +0200 Subject: [PATCH] Switch to ruamel.yaml --- .travis.yml | 2 +- CHANGELOG.rst | 1 + appveyor.yml | 2 +- beem/cli.py | 1 - beem/utils.py | 7 ++++--- docs/requirements.txt | 3 +-- requirements-test.txt | 3 +-- setup.py | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9528f6df..da70e437 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ before_install: - pip install --upgrade wheel # Set numpy version first, other packages link against it - pip install six nose coverage codecov pytest pytest-cov coveralls codacy-coverage parameterized secp256k1prp cryptography scrypt - - pip install pycryptodomex pyyaml appdirs pylibscrypt tox diff_match_patch asn1crypto + - pip install pycryptodomex ruamel.yaml appdirs pylibscrypt tox diff_match_patch asn1crypto - pip install ecdsa requests websocket-client pytz six Click prettytable click_shell script: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2e53a4b6..e998c3ad 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,7 @@ Changelog 0.24.14 ------- * Add option add_tor to config storage, which allows it to use beempy in tails +* Switch from pyyaml to ruamel.yaml * Remove Events requirements, beem.notify and beemapi.websocket, as it is not well tested and there are no websocket api nodes available on hive * Remove unnecessary requirements (pylibscrypt and future * add new node (fin.hive.3speak.co) and change change rpc.esteem.app to rpc.ecency.com diff --git a/appveyor.yml b/appveyor.yml index 9bed4837..e18f6d34 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,7 +50,7 @@ install: - cmd: conda update -q conda - cmd: conda info -a - cmd: conda install --yes conda-build setuptools pip parameterized cryptography -- cmd: conda install --yes pycryptodomex pyyaml pytest pytest-mock coverage mock appdirs pylibscrypt pywin32 +- cmd: conda install --yes pycryptodomex ruamel.yaml pytest pytest-mock coverage mock appdirs pylibscrypt pywin32 - cmd: pip install scrypt -U - cmd: conda install --yes ecdsa requests websocket-client pytz six Click prettytable pyinstaller click-shell asn1crypto diff --git a/beem/cli.py b/beem/cli.py index 52c9b95d..15dcc817 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -16,7 +16,6 @@ import random import logging import click from click_shell import shell -import yaml import re from beem.instance import set_shared_blockchain_instance, shared_blockchain_instance from beem.amount import Amount diff --git a/beem/utils.py b/beem/utils.py index 36a631c0..01a796be 100644 --- a/beem/utils.py +++ b/beem/utils.py @@ -6,7 +6,7 @@ import math from datetime import datetime, tzinfo, timedelta, date, time import pytz import difflib -import yaml +from ruamel.yaml import YAML timeFormat = "%Y-%m-%dT%H:%M:%S" # https://github.com/matiasb/python-unidiff/blob/master/unidiff/constants.py#L37 @@ -371,9 +371,10 @@ def seperate_yaml_dict_from_body(content): if len(content.split("---\n")) > 1: body = content[content.find("---\n", 1) + 4 :] yaml_content = content[content.find("---\n") + 4 : content.find("---\n", 1)] - parameter = yaml.load(yaml_content, Loader=yaml.FullLoader) + yaml=YAML(typ="safe") + parameter = yaml.load(yaml_content) if not isinstance(parameter, dict): - parameter = yaml.load(yaml_content.replace(":", ": ").replace(" ", " "), Loader=yaml.FullLoader) + parameter = yaml.load(yaml_content.replace(":", ": ").replace(" ", " ")) else: body = content return body, parameter diff --git a/docs/requirements.txt b/docs/requirements.txt index fed1bfab..cb480b03 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -6,8 +6,7 @@ websocket-client pytz pycryptodomex>=3.4.6 scrypt>=0.7.1 -Events>=0.2.2 -pyyaml +ruamel.yaml pytest pytest-mock coverage diff --git a/requirements-test.txt b/requirements-test.txt index 5f48d124..c20b9428 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -8,9 +8,8 @@ websocket-client==0.57.0 pytz==2020.1 pycryptodomex==3.9.8 scrypt==0.8.17 -Events==0.3 cryptography==3.1.1 -pyyaml>=4.2b1 +ruamel.yaml mock==4.0.2 appdirs==1.4.4 Click==7.1.2 diff --git a/setup.py b/setup.py index ba4e77f7..4b6a8cfc 100755 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ requires = [ "Click", "click_shell", "prettytable", - "pyyaml>=5.1", + "ruamel.yaml", "diff_match_patch", "asn1crypto" ] -- GitLab