From 314d27bec1fc96a63690309753b1b81e2872f028 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 1 Feb 2023 20:21:19 +0100 Subject: [PATCH] Fix flake8 complains --- doc/generate_api_doc.py | 13 +++++++------ src/settings.py | 2 +- tox.ini | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/generate_api_doc.py b/doc/generate_api_doc.py index fc44ffbcd..514415eef 100644 --- a/doc/generate_api_doc.py +++ b/doc/generate_api_doc.py @@ -26,15 +26,16 @@ import requests def main(): - """ """ + with open("../share/actionsmap.yml") as f: action_map = yaml.safe_load(f) - try: - with open("/etc/yunohost/current_host", "r") as f: - domain = f.readline().rstrip() - except IOError: - domain = requests.get("http://ip.yunohost.org").text + #try: + # with open("/etc/yunohost/current_host", "r") as f: + # domain = f.readline().rstrip() + #except IOError: + # domain = requests.get("http://ip.yunohost.org").text + with open("../debian/changelog") as f: top_changelog = f.readline() api_version = top_changelog[top_changelog.find("(") + 1 : top_changelog.find(")")] diff --git a/src/settings.py b/src/settings.py index d1203930d..a06377176 100644 --- a/src/settings.py +++ b/src/settings.py @@ -198,7 +198,7 @@ class SettingsConfigPanel(ConfigPanel): self.values["passwordless_sudo"] = "!authenticate" in ldap.search( "ou=sudo", "cn=admins", ["sudoOption"] )[0].get("sudoOption", []) - except: + except Exception: self.values["passwordless_sudo"] = False def get(self, key="", mode="classic"): diff --git a/tox.ini b/tox.ini index dc2c52074..49c78959d 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ deps = py39-black-{run,check}: black py39-mypy: mypy >= 0.900 commands = - py39-lint: flake8 src doc maintenance tests --ignore E402,E501,E203,W503 --exclude src/vendor + py39-lint: flake8 src doc maintenance tests --ignore E402,E501,E203,W503,E741 --exclude src/vendor py39-invalidcode: flake8 src bin maintenance --exclude src/tests,src/vendor --select F,E722,W605 py39-black-check: black --check --diff bin src doc maintenance tests py39-black-run: black bin src doc maintenance tests