Skip to content

Commit

Permalink
Fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
maximyurchuk committed Aug 16, 2024
1 parent 5b55710 commit f544fdb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ydb/apps/dstool/lib/arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _additional_eq(self, other):

def __eq__(self, other):
return all((
type(self) == type(other),
type(self) is type(other),
self.name == other.name,
self.type == other.type,
self.choices == other.choices,
Expand Down
9 changes: 6 additions & 3 deletions ydb/apps/dstool/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,20 +818,23 @@ def fetch_json_info(entity, nodes=None, enums=1):
elif entity == 'vdiskinfo':
section, keycols = 'VDiskStateInfo', ['NodeId', 'PDiskId', 'VDiskSlotId']

def merge(x, y):
def merge_fn(x, y):
return max([x, y], key=lambda x: x.get('GroupGeneration', 0))
merge = merge_fn
elif entity == 'tabletinfo':
section, keycols = 'TabletStateInfo', ['TabletId']

def merge(x, y):
def merge_fn(x, y):
return max([x, y], key=lambda x: x.get('Generation', 0))
merge = merge_fn
elif entity == 'bsgroupinfo':
section, keycols = 'BSGroupStateInfo', ['GroupID']

def merge(x, y):
def merge_fn(x, y):
return x if x.get('GroupGeneration', 0) > y.get('GroupGeneration', 0) else \
y if y.get('GroupGeneration', 0) > x.get('GroupGeneration', 0) else \
x if x.get('VDiskIds', []) else y
merge = merge_fn
else:
assert False
res = {}
Expand Down
8 changes: 3 additions & 5 deletions ydb/library/yql/core/expr_nodes_gen/gen/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import sys
import getopt
import json
import re

Expand All @@ -17,7 +16,7 @@
env = Environment(loader=FileSystemLoader(templateDir))
template = env.get_template(templateFilename)

json_data=open(jsonFile)
json_data = open(jsonFile)
model = json.load(json_data)
json_data.close()

Expand Down Expand Up @@ -51,7 +50,7 @@
child["Optional"] = False

if node["Base"] == model["FreeArgCallableBase"]:
aux["isFinal"] = True;
aux["isFinal"] = True

# Traverse tree
nodesMap = {}
Expand Down Expand Up @@ -135,7 +134,7 @@ def isListBuilder(node):
raise Exception("Child #" + str(index) + " should be optional in " + node["Name"])
optionalArgs = child["Optional"]
if not child["Optional"]:
aux["fixedChildrenCount"] += 1;
aux["fixedChildrenCount"] += 1

if "Match" in node and node["Match"]["Type"] == "CallableBase":
namesToMatch = aux["namesToMatch"] = []
Expand Down Expand Up @@ -202,4 +201,3 @@ def addUsages(typename):
defsOutput = template.render(generator=__file__, genType="Definitions", model=model, nodes=model["Nodes"])
with open(defsOutFile, "w") as fh:
fh.write(defsOutput)

0 comments on commit f544fdb

Please sign in to comment.