diff --git a/core/cdag/tx.py b/core/cdag/tx.py index 899bc9149091c3910b985dec52142c2d1cb9c82f..821531ad16a3d036ef38dcceb59aac3321e3b9e8 100644 --- a/core/cdag/tx.py +++ b/core/cdag/tx.py @@ -6,7 +6,7 @@ # ---------------------------------------------------------------------- # Python modules -from typing import Any, Dict, Optional +from typing import Any, Dict # NOC modules from .typing import ValueType diff --git a/core/profile/base.py b/core/profile/base.py index 572094630f9a971aeb14bb37245be9a1dc0924c6..346a6cbdc549ad2a1d62d341d58de3b88a82f43e 100644 --- a/core/profile/base.py +++ b/core/profile/base.py @@ -182,8 +182,8 @@ class BaseProfile(object, metaclass=BaseProfileMetaclass): NB: Sending logic is implemented in *commands* script Examples: - "^.+\\" -- treat trailing backspace as continuation - "banner\s+login\s+(\S+)" -- continue until matched group + r"^.+\\" -- treat trailing backspace as continuation + r"banner\s+login\s+(\S+)" -- continue until matched group # noqa: W605 """ pattern_mml_end = None diff --git a/scripts/deploy/change-ip.py b/scripts/deploy/change-ip.py index 5ee57c73f54c2671ecaa13c15c64dfeac0fe8617..0eb73787e46886fb44b679822db67ada1fd1bcbc 100755 --- a/scripts/deploy/change-ip.py +++ b/scripts/deploy/change-ip.py @@ -50,21 +50,31 @@ ALL_PATHS = [ TELEGRAF_PG, TELEGRAF_MG, TELEGRAF_NG, - PGBOUNCER + PGBOUNCER, ] + def take_postgresql_version(): distr_family = guess_system_type() ver = "" if distr_family == "deb": - sp = subprocess.run(['dpkg-query -W -f=\'${package} ${status}\n\' postgresql-*|grep "install ok installed" | ' - 'grep -Po "(\\d.?\\d+)"|sort -u'], stdout=subprocess.PIPE, shell=True) - ver = str(sp.stdout.decode('utf-8')).rstrip('\n') + sp = subprocess.run( + [ + "dpkg-query -W -f='${package} ${status}\n' postgresql-*|grep \"install ok installed\" | " + 'grep -Po "(\\d.?\\d+)"|sort -u' + ], + stdout=subprocess.PIPE, + shell=True, + ) + ver = str(sp.stdout.decode("utf-8")).rstrip("\n") return ver if distr_family == "rpm": - sp = subprocess.run(['yum list installed postgresql* | ' - 'grep -Po \'postgresql\\K\\d*(?=-server)\''], stdout=subprocess.PIPE, shell=True) - ver = str(sp.stdout.decode('utf-8')).rstrip('\n') + sp = subprocess.run( + ["yum list installed postgresql* | " "grep -Po 'postgresql\\K\\d*(?=-server)'"], + stdout=subprocess.PIPE, + shell=True, + ) + ver = str(sp.stdout.decode("utf-8")).rstrip("\n") if ver == "96": ver = "9.6" return ver @@ -74,8 +84,10 @@ def take_postgresql_version(): def guess_system_type(): """Trys to figure out what system do we have, deb or rpm like""" - stream = os.popen('grep "^NAME=" /etc/os-release |cut -d "=" -f 2 | sed -e \'s/^"//\' -e \'s/"$//\'') - output = stream.read().rstrip('\n') + stream = os.popen( + 'grep "^NAME=" /etc/os-release |cut -d "=" -f 2 | sed -e \'s/^"//\' -e \'s/"$//\'' + ) + output = stream.read().rstrip("\n") if "Ubuntu" in output or "Debian GNU/Linux" in output: distr_fam = "deb" diff --git a/services/classifier/xrulelookup.py b/services/classifier/xrulelookup.py index 6b871d3d30171977ebf201661ca254b31e939614..42d27abe7d32a5b6afcbefa6ff9fa53a8cccc13a 100644 --- a/services/classifier/xrulelookup.py +++ b/services/classifier/xrulelookup.py @@ -17,7 +17,9 @@ import sre_parse try: import esmre as esm except (ModuleNotFoundError, ImportError): - raise NotImplementedError("XRuleLookup needed ESMRE library for worked. Please, install it from pip") + raise NotImplementedError( + "XRuleLookup needed ESMRE library for worked. Please, install it from pip" + ) import bitarray # NOC modules