Skip to content

Commit f9c3849

Browse files
committed
test: fix E501 errors by pycodestyle
Fixed 11 occurrences of E501 ("line too long") error reported by pycodestyle[1]. [1]: https://www.flake8rules.com/rules/E501.html
1 parent 2559a1d commit f9c3849

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

src/luajit-gdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ def dump_lj_tfunc(tv):
430430

431431
if ffid == 0:
432432
pt = funcproto(func)
433-
return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
433+
return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
434434
addr=strx64(func),
435-
nupvals=int(func['nupvalues']),
435+
nups=int(func['nupvalues']),
436436
chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
437437
line=pt['firstline']
438438
)

src/luajit_lldb.py

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ def __sub__(self, other):
5050
if isinstance(other, int):
5151
return self.__add__(-other)
5252
else:
53-
return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
53+
return int((self.value.unsigned - other.value.unsigned)
54+
/ sizeof(self.normal_type.__name__))
5455

5556
def __eq__(self, other):
56-
assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
57+
assert isinstance(other, Ptr) or isinstance(other, int) and other >= 0
5758
if isinstance(other, Ptr):
5859
return self.value.unsigned == other.value.unsigned
5960
else:
@@ -126,19 +127,22 @@ def addr(self):
126127

127128
c_structs = {
128129
'MRef': [
129-
(property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
130+
(property(lambda self: self['ptr64'].unsigned if LJ_GC64
131+
else self['ptr32'].unsigned), 'ptr')
130132
],
131133
'GCRef': [
132-
(property(lambda self: self['gcptr64'].unsigned if LJ_GC64 else self['gcptr32'].unsigned), 'gcptr')
134+
(property(lambda self: self['gcptr64'].unsigned if LJ_GC64
135+
else self['gcptr32'].unsigned), 'gcptr')
133136
],
134137
'TValue': [
135138
('GCRef', 'gcr'),
136139
('uint', 'it'),
137140
('uint', 'i'),
138141
('int', 'it64'),
139142
('string', 'n'),
140-
(property(lambda self: self['ftsz'].signed if LJ_GC64 else None), 'ftsz'),
141-
(property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr')
143+
(property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr'),
144+
(property(lambda self: self['ftsz'].signed if LJ_GC64 else None),
145+
'ftsz')
142146
],
143147
'GCState': [
144148
('GCRef', 'root'),
@@ -223,16 +227,10 @@ def addr(self):
223227
for cls in Struct.__subclasses__():
224228
ptr_name = cls.__name__ + 'Ptr'
225229

226-
def make_ptr_init(nm, cls):
227-
return type(
228-
nm,
229-
(Ptr,),
230-
{
231-
'__init__': lambda self, value: super(type(self), self).__init__(value, cls)
232-
}
233-
)
234-
235-
globals()[ptr_name] = make_ptr_init(ptr_name, cls)
230+
globals()[ptr_name] = type(ptr_name, (Ptr,), {
231+
'__init__':
232+
lambda self, value: super(type(self), self).__init__(value, cls)
233+
})
236234

237235

238236
class Command(object):
@@ -590,9 +588,9 @@ def dump_lj_tfunc(tv):
590588

591589
if ffid == 0:
592590
pt = funcproto(func)
593-
return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
591+
return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
594592
addr=strx64(func),
595-
nupvals=func.nupvalues,
593+
nups=func.nupvalues,
596594
chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
597595
line=pt.firstline
598596
)
@@ -737,7 +735,8 @@ def frame_prevl(framelink):
737735
# a struct member of 32-bit type to 64-bit type without getting onto
738736
# the next property bits, despite the fact that it's an actual value, not
739737
# a pointer to it.
740-
return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
738+
bcins = vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))
739+
return framelink - (1 + LJ_FR2 + bc_a(bcins))
741740

742741

743742
def frame_ispcall(framelink):
@@ -852,10 +851,15 @@ def dump_stack(L, base=None, top=None):
852851
nstackslots=int((maxstack - stack) >> 3),
853852
),
854853
dump_stack_slot(L, maxstack, base, top),
855-
'{start:{padding}}:{end:{padding}} [ ] {nfreeslots} slots: Free stack slots'.format(
856-
start=strx64(top + 1),
857-
end=strx64(maxstack - 1),
858-
padding=len(PADDING),
854+
'{start}:{end} [ ] {nfreeslots} slots: Free stack slots'.format(
855+
start='{address:{padding}}'.format(
856+
address=strx64(top + 1),
857+
padding=len(PADDING),
858+
),
859+
end='{address:{padding}}'.format(
860+
address=strx64(maxstack - 1),
861+
padding=len(PADDING),
862+
),
859863
nfreeslots=int((maxstack - top - 8) >> 3),
860864
),
861865
])
@@ -1075,9 +1079,10 @@ def register_commands(debugger, commands):
10751079
for command, cls in commands.items():
10761080
cls.command = command
10771081
debugger.HandleCommand(
1078-
'command script add --overwrite --class luajit_lldb.{cls} {command}'.format(
1082+
'command script add --overwrite --class luajit_lldb.{cls} {cmd}'
1083+
.format(
10791084
cls=cls.__name__,
1080-
command=cls.command,
1085+
cmd=cls.command,
10811086
)
10821087
)
10831088
print('{cmd} command intialized'.format(cmd=cls.command))

0 commit comments

Comments
 (0)