Fix flake8 complains

This commit is contained in:
Alexandre Aubin 2023-02-01 20:21:19 +01:00
parent 452ba8bb9a
commit 314d27bec1
3 changed files with 9 additions and 8 deletions

View file

@ -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(")")]

View file

@ -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"):

View file

@ -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