Skip to content

Commit

Permalink
Fix variable naming to match project conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse-sony committed Aug 28, 2023
1 parent be761c2 commit 82d976d
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions yapf/yapflib/format_decision_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,10 @@ def SurroundedByParens(token):
(opening.matching_bracket.next_token and
opening.matching_bracket.next_token.value != ',' and
not opening.matching_bracket.next_token.ClosesScope())):
argLengths = _CalculateArgLengths(opening)
startCol = self.column + len(current.value) + len(opening.value)
for length in argLengths:
length += startCol
arg_lengths = _CalculateArgLengths(opening)
start_col = self.column + len(current.value) + len(opening.value)
for length in arg_lengths:
length += start_col
if length > self.column_limit:
return True

Expand Down Expand Up @@ -1203,37 +1203,37 @@ def _ScopeHasNoCommas(token):

def _CalculateArgLengths(opening):
"""Calculate the length of each function arg, if the args are wrapped"""
argList = list()
arg_list = list()
token = opening.next_token
shortList = list()
deltaList = list()
short_list = list()
delta_list = list()
delta = 0
while token:
shortList.append(token)
short_list.append(token)
if token.name == "COMMA":
argList.append(shortList)
deltaList.append(delta)
shortList = list()
arg_list.append(short_list)
delta_list.append(delta)
short_list = list()
delta = 0
elif token.name == "LPAR":
if _IsFunctionCallWithArguments(token.previous_token):
maxArg = max(_CalculateArgLengths(token))
endToken = token.matching_bracket
innerLength = endToken.total_length - token.total_length
delta = innerLength - maxArg
max_arg = max(_CalculateArgLengths(token))
end_token = token.matching_bracket
inner_length = end_token.total_length - token.total_length
delta = inner_length - max_arg
token = token.matching_bracket
shortList.append(token)
short_list.append(token)
elif token.name == "RPAR":
argList.append(shortList)
deltaList.append(delta)
arg_list.append(short_list)
delta_list.append(delta)
break
token = token.next_token

argLengths = list()
for l, d in zip(argList, deltaList):
argLen = l[-1].total_length - l[0].total_length + len(l[0].value) - d
argLengths.append(argLen)
return argLengths
arg_lengths = list()
for l, d in zip(arg_list, delta_list):
arg_len = l[-1].total_length - l[0].total_length + len(l[0].value) - d
arg_lengths.append(arg_len)
return arg_lengths


class _ParenState(object):
Expand Down

0 comments on commit 82d976d

Please sign in to comment.