Commit 2aa3d5ad authored by Dmitry Volodin's avatar Dmitry Volodin Committed by Andrey Vertiprahov
Browse files

Fix formatting

parent 0641198a
......@@ -14,7 +14,7 @@ check labels:
stage: Lint
image: registry.getnoc.com/infrastructure/noc-py-lint:master
script:
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) $CI_COMMIT_SHA)
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA)
- python ./scripts/check-labels.py --junit-report=build/reports/labels-junit.xml $FLIST
only:
- merge_requests
......@@ -32,7 +32,7 @@ flake8:
image: registry.getnoc.com/infrastructure/noc-py-lint:master
script:
- set -x
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- >
if [ ! -z "$FLIST" ];
then
......@@ -61,7 +61,7 @@ black:
image: registry.getnoc.com/infrastructure/noc-py-lint:master
script:
- set -x
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- >
if [ ! -z "$FLIST" ];
then
......@@ -87,7 +87,7 @@ mypy:
image: registry.getnoc.com/infrastructure/noc-py-lint:master
script:
- set -x
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- >
if [ ! -z "$FLIST" ];
then
......@@ -111,7 +111,7 @@ prettier:
image: registry.getnoc.com/infrastructure/prettier:master
script:
- set -x
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) $CI_COMMIT_SHA | egrep "\.(js|json|yml|css)$" | grep -v ".docker/"|| true)
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA | egrep "\.(js|json|yml|css)$" | grep -v ".docker/"|| true)
- >
if [ ! -z "$FLIST" ];
then
......@@ -141,7 +141,7 @@ pylint:
image: registry.getnoc.com/infrastructure/noc-py-lint:master
script:
- set -x
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- FLIST=$(git --no-pager diff --diff-filter=d --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA | egrep ".py$" | grep -v ".docker/"|| true)
- >
if [ ! -z "$FLIST" ];
then
......@@ -213,7 +213,7 @@ build:Docs:
image: registry.getnoc.com/infrastructure/docs3:master
script:
- set -x
- FLIST=$(git --no-pager diff --name-only $CI_COMMIT_SHA $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA) | egrep "^docs/" || true)
- FLIST=$(git --no-pager diff --name-only $CI_COMMIT_SHA $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) | egrep "^docs/" || true)
- >
if [ ! -z "$FLIST" ];
then
......
......@@ -72,9 +72,7 @@ class ModelProtectionProfile(Document):
def __str__(self):
return self.name
def save(
self, *args, **kwargs,
):
def save(self, *args, **kwargs):
if "field_access" in getattr(self, "_changed_fields", []):
# Check unique
processed = set()
......
......@@ -14,7 +14,6 @@ from noc.core.migration.base import BaseMigration
class Migration(BaseMigration):
def migrate(self):
# Model 'ObjectCategory'
self.db.create_table(
"cm_objectcategory",
......
......@@ -17,7 +17,6 @@ OBJECT_TYPE_CHOICES = [(x, x) for x in OBJECT_TYPES]
class Migration(BaseMigration):
def migrate(self):
self.db.delete_column("cm_objectcategory", "notify_immediately")
self.db.delete_column("cm_objectcategory", "notify_delayed")
......
......@@ -11,7 +11,6 @@ from noc.core.migration.base import BaseMigration
class Migration(BaseMigration):
TAG_MODELS = ["cm_objectnotify"]
def migrate(self):
......
......@@ -16,7 +16,6 @@ from noc.config import config
class Command(BaseCommand):
FIX_DIRS = config.get_customized_paths("fixes")
def add_arguments(self, parser):
......
......@@ -43,7 +43,6 @@ class Command(BaseCommand):
help = "Import data from rancid"
def add_arguments(self, parser):
parser.add_argument(
parser.add_argument(
"--routerdb", action="append", dest="routerdb", help="Path to the router.db"
......
......@@ -27,7 +27,6 @@ class Command(BaseCommand):
LAYOUT = ["neato", "cicro", "sfdp", "dot", "twopi"]
def add_arguments(self, parser):
parser.add_argument(
"--afi", dest="afi", action="store", default="4", help="AFI (ipv4/ipv6)"
),
......
......@@ -181,13 +181,7 @@ class Command(BaseCommand):
run_sync(subscribe)
def handle_set_cursor(
self,
name: str,
stream: str,
partition: int = 0,
offset: int = 0,
*args,
**kwargs,
self, name: str, stream: str, partition: int = 0, offset: int = 0, *args, **kwargs
):
async def set_cursor():
async with LiftBridgeClient() as client:
......
......@@ -90,9 +90,7 @@ class Command(BaseCommand):
def check_direction(self, c, directions):
if (c.direction) and (c.direction in directions):
return
self.e(
c, "'%s' must have direction %s (has '%s')" % (c.type.name, directions, c.direction),
)
self.e(c, "'%s' must have direction %s (has '%s')" % (c.type.name, directions, c.direction))
def check_ct_db9(self, c):
self.check_direction(c, ["s"])
......@@ -141,7 +139,7 @@ class Command(BaseCommand):
)
elif any("100BASELX" in s for s in c.protocols):
self.check_protocols(
c, [">100BASELX-1310", "<100BASELX-1310", ">100BASELX-1550", "<100BASELX-1550"],
c, [">100BASELX-1310", "<100BASELX-1310", ">100BASELX-1550", "<100BASELX-1550"]
)
elif any("1000BASEZX" in s for s in c.protocols):
self.check_protocols(
......
......@@ -73,14 +73,13 @@ def in_lookup(seq, model=None):
s3 = " NOT" if ("$not" in seq) or ("$NOT" in seq) else ""
# check int
m = []
for l in seq[1]:
if isinstance(l, int) or l.isdigit():
m += [int(l)]
for item in seq[1]:
if isinstance(item, int) or item.isdigit():
m += [int(item)]
continue
if len(seq[1]) == 1:
return "%s%s IN %s" % (seq[0]["$field"], s3, m[0])
else:
return "%s%s IN %s" % (seq[0]["$field"], s3, tuple(m))
return "%s%s IN %s" % (seq[0]["$field"], s3, tuple(m))
def f_ternary_if(seq, model=None):
......@@ -151,7 +150,6 @@ def f_selector(seq, model=None):
def f_quantile(seq):
return "quantile(%f)(%s)" % seq
......
......@@ -80,7 +80,7 @@ class PredicateTransformer(ast.NodeTransformer):
fn = getattr(self.engine, attr_name)
return ast.Call(
func=ast.Attribute(
value=ast.Name(id="self", ctx=ast.Load()), attr=attr_name, ctx=ast.Load(),
value=ast.Name(id="self", ctx=ast.Load()), attr=attr_name, ctx=ast.Load()
),
args=[_input] + self.visit_args(fn, node.args),
keywords=[ast.keyword(arg=k.arg, value=self.wrap_expr(k.value)) for k in node.keywords],
......
......@@ -296,7 +296,7 @@ class BaseNormalizer(object, metaclass=BaseNormalizerMetaclass):
Mark the part of tree to be rebased to new location
Usage:
yield self.rebase(src, dst):
yield self.rebase(src, dst)
:param src: Source path
:param dst: Destination path
......
# ----------------------------------------------------------------------
# ConfDB system syntax
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -130,7 +130,7 @@ SYSTEM_SYNTAX = DEF(
SYSTEM_AAA_SYNTAX,
DEF(
"security",
[DEF("certificate", [DEF(ANY, name="name", gen="make_system_security_certificate")]),],
[DEF("certificate", [DEF(ANY, name="name", gen="make_system_security_certificate")])],
),
],
)
......@@ -74,7 +74,7 @@ VRRP_SYNTAX = DEF(
"preempt",
[
DEF(
"enabled", [DEF(BOOL, name="enabled", gen="make_vrrp_preempt")],
"enabled", [DEF(BOOL, name="enabled", gen="make_vrrp_preempt")]
),
DEF(
"timer",
......
......@@ -52,7 +52,7 @@ class BaseScriptMetaclass(type):
def __new__(mcs, name, bases, attrs):
n = type.__new__(mcs, name, bases, attrs)
n._execute_chain = sorted(
(v for v in attrs.values() if hasattr(v, "_seq")), key=operator.attrgetter("_seq"),
(v for v in attrs.values() if hasattr(v, "_seq")), key=operator.attrgetter("_seq")
)
return n
......
......@@ -120,8 +120,6 @@ class BERDecoder(object):
return v
def parse_real(self, msg: bytes) -> float:
"""
"""
if not msg:
return 0.0
f = msg[0]
......
......@@ -446,14 +446,14 @@ def find_indented(s):
"""
r = []
cr = []
for l in s.splitlines():
if rx_notspace.match(l):
for line in s.splitlines():
if rx_notspace.match(line):
if len(cr) > 1:
r += ["\n".join(cr)]
cr = [l]
cr = [line]
continue
elif l:
cr += [l]
elif line:
cr += [line]
if len(cr) > 1:
r += ["\n".join(cr)]
return r
......@@ -572,7 +572,7 @@ def safe_shadow(text):
'******'
>>> safe_shadow([1, 2])
'******'
"""
"""
if not text:
return "None"
elif not isinstance(text, str):
......
......@@ -13,7 +13,6 @@ from noc.core.migration.base import BaseMigration
class Migration(BaseMigration):
depends_on = [("wf", "0001_default_wf")]
def migrate(self):
......
......@@ -14,7 +14,6 @@ from noc.core.migration.base import BaseMigration
class Migration(BaseMigration):
def migrate(self):
# Model 'DNSServer'
self.db.create_table(
"dns_dnsserver",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment