Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>,
	Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 errors by pycodestyle
Date: Tue,  8 Aug 2023 19:42:40 +0000	[thread overview]
Message-ID: <f9c3849e15bd559406d79b7054150425e9907fad.1691523040.git.imun@tarantool.org> (raw)
In-Reply-To: <ZNKXqyzRbPEuC3QG@tarantool.org>

Fixed 11 occurrences of E501 ("line too long") error reported by
pycodestyle[1].

[1]: https://www.flake8rules.com/rules/E501.html

Signed-off-by: Igor Munkin <imun@tarantool.org>
---

**NB**: This patch will be placed between "[PATCH luajit 10/15] test:
fix E305 errors by pycodestyle" and "[PATCH luajit 11/15] test: fix E502
errors by pycodestyle" on the branch.

CI: https://github.com/tarantool/luajit/actions/runs/5800936024/job/15724104222

 src/luajit-gdb.py  |  4 ++--
 src/luajit_lldb.py | 55 +++++++++++++++++++++++++---------------------
 2 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 9dcddb17..5eaf250f 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -430,9 +430,9 @@ def dump_lj_tfunc(tv):
 
     if ffid == 0:
         pt = funcproto(func)
-        return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
+        return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
             addr=strx64(func),
-            nupvals=int(func['nupvalues']),
+            nups=int(func['nupvalues']),
             chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
             line=pt['firstline']
         )
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 13d9f2e3..ef0986cc 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -50,10 +50,11 @@ class Ptr:
         if isinstance(other, int):
             return self.__add__(-other)
         else:
-            return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
+            return int((self.value.unsigned - other.value.unsigned)
+                       / sizeof(self.normal_type.__name__))
 
     def __eq__(self, other):
-        assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
+        assert isinstance(other, Ptr) or isinstance(other, int) and other >= 0
         if isinstance(other, Ptr):
             return self.value.unsigned == other.value.unsigned
         else:
@@ -126,10 +127,12 @@ class Struct(metaclass=MetaStruct):
 
 c_structs = {
     'MRef': [
-        (property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
+        (property(lambda self: self['ptr64'].unsigned if LJ_GC64
+                  else self['ptr32'].unsigned), 'ptr')
     ],
     'GCRef': [
-        (property(lambda self: self['gcptr64'].unsigned if LJ_GC64 else self['gcptr32'].unsigned), 'gcptr')
+        (property(lambda self: self['gcptr64'].unsigned if LJ_GC64
+                  else self['gcptr32'].unsigned), 'gcptr')
     ],
     'TValue': [
         ('GCRef', 'gcr'),
@@ -137,8 +140,9 @@ c_structs = {
         ('uint', 'i'),
         ('int', 'it64'),
         ('string', 'n'),
-        (property(lambda self: self['ftsz'].signed if LJ_GC64 else None), 'ftsz'),
-        (property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr')
+        (property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr'),
+        (property(lambda self: self['ftsz'].signed if LJ_GC64 else None),
+         'ftsz')
     ],
     'GCState': [
         ('GCRef', 'root'),
@@ -223,16 +227,10 @@ for cls in c_structs.keys():
 for cls in Struct.__subclasses__():
     ptr_name = cls.__name__ + 'Ptr'
 
-    def make_ptr_init(nm, cls):
-        return type(
-                nm,
-                (Ptr,),
-                {
-                    '__init__': lambda self, value: super(type(self), self).__init__(value, cls)
-                }
-            )
-
-    globals()[ptr_name] = make_ptr_init(ptr_name, cls)
+    globals()[ptr_name] = type(ptr_name, (Ptr,), {
+        '__init__':
+            lambda self, value: super(type(self), self).__init__(value, cls)
+    })
 
 
 class Command(object):
@@ -590,9 +588,9 @@ def dump_lj_tfunc(tv):
 
     if ffid == 0:
         pt = funcproto(func)
-        return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
+        return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
             addr=strx64(func),
-            nupvals=func.nupvalues,
+            nups=func.nupvalues,
             chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
             line=pt.firstline
         )
@@ -737,7 +735,8 @@ def frame_prevl(framelink):
     # a struct member of 32-bit type to 64-bit type without getting onto
     # the next property bits, despite the fact that it's an actual value, not
     # a pointer to it.
-    return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
+    bcins = vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))
+    return framelink - (1 + LJ_FR2 + bc_a(bcins))
 
 
 def frame_ispcall(framelink):
@@ -852,10 +851,15 @@ def dump_stack(L, base=None, top=None):
             nstackslots=int((maxstack - stack) >> 3),
         ),
         dump_stack_slot(L, maxstack, base, top),
-        '{start:{padding}}:{end:{padding}} [    ] {nfreeslots} slots: Free stack slots'.format(
-            start=strx64(top + 1),
-            end=strx64(maxstack - 1),
-            padding=len(PADDING),
+        '{start}:{end} [    ] {nfreeslots} slots: Free stack slots'.format(
+            start='{address:{padding}}'.format(
+                address=strx64(top + 1),
+                padding=len(PADDING),
+            ),
+            end='{address:{padding}}'.format(
+                address=strx64(maxstack - 1),
+                padding=len(PADDING),
+            ),
             nfreeslots=int((maxstack - top - 8) >> 3),
         ),
     ])
@@ -1075,9 +1079,10 @@ def register_commands(debugger, commands):
     for command, cls in commands.items():
         cls.command = command
         debugger.HandleCommand(
-            'command script add --overwrite --class luajit_lldb.{cls} {command}'.format(
+            'command script add --overwrite --class luajit_lldb.{cls} {cmd}'
+            .format(
                 cls=cls.__name__,
-                command=cls.command,
+                cmd=cls.command,
             )
         )
         print('{cmd} command intialized'.format(cmd=cls.command))
-- 
2.30.2


  parent reply	other threads:[~2023-08-08 19:57 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-03 14:25   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:49   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 " Igor Munkin via Tarantool-patches
2023-08-03 14:26   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:52   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 " Igor Munkin via Tarantool-patches
2023-08-03 14:26   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:53   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 " Igor Munkin via Tarantool-patches
2023-08-03 14:26   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:55   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 " Igor Munkin via Tarantool-patches
2023-08-03 14:26   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:55   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 " Igor Munkin via Tarantool-patches
2023-08-03 14:27   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:58   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 " Igor Munkin via Tarantool-patches
2023-08-03 14:28   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:01   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 " Igor Munkin via Tarantool-patches
2023-08-03 14:28   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:02   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 " Igor Munkin via Tarantool-patches
2023-08-03 14:28   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:03   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 " Igor Munkin via Tarantool-patches
2023-08-03 14:28   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:05   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 " Igor Munkin via Tarantool-patches
2023-08-03 14:29   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:06   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 " Igor Munkin via Tarantool-patches
2023-08-03 14:29   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:06   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 " Igor Munkin via Tarantool-patches
2023-08-03 14:29   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:10   ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 " Igor Munkin via Tarantool-patches
2023-08-03 14:34   ` Sergey Bronnikov via Tarantool-patches
2023-08-07 11:00     ` Igor Munkin via Tarantool-patches
2023-08-07 13:45       ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:15   ` Maxim Kokryashkin via Tarantool-patches
2023-08-07 10:57     ` Igor Munkin via Tarantool-patches
2023-08-13 20:25       ` Maxim Kokryashkin via Tarantool-patches
2023-08-03  7:30 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Igor Munkin via Tarantool-patches
2023-08-03 14:23   ` Sergey Bronnikov via Tarantool-patches
2023-08-03 14:25     ` Sergey Bronnikov via Tarantool-patches
2023-08-07 13:35       ` Igor Munkin via Tarantool-patches
2023-08-07 13:41         ` [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage Igor Munkin via Tarantool-patches
2023-08-08  8:26           ` Sergey Bronnikov via Tarantool-patches
2023-08-13 20:24           ` Maxim Kokryashkin via Tarantool-patches
2023-08-07 13:41         ` [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-08  8:26           ` Sergey Bronnikov via Tarantool-patches
2023-08-13 19:25           ` Maxim Kokryashkin via Tarantool-patches
2023-08-08  8:18         ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Sergey Bronnikov via Tarantool-patches
2023-08-07 12:17     ` Igor Munkin via Tarantool-patches
2023-08-07 13:48       ` Sergey Bronnikov via Tarantool-patches
2023-08-03 21:02   ` Maxim Kokryashkin via Tarantool-patches
2023-08-08 19:29     ` Igor Munkin via Tarantool-patches
2023-08-08 19:42       ` [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-13 13:52         ` Maxim Kokryashkin via Tarantool-patches
2023-08-08 19:42       ` Igor Munkin via Tarantool-patches [this message]
2023-08-13 13:55         ` [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 " Maxim Kokryashkin via Tarantool-patches
2023-08-14  7:28       ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Maxim Kokryashkin via Tarantool-patches
2023-08-21 11:05 ` [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9c3849e15bd559406d79b7054150425e9907fad.1691523040.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 errors by pycodestyle' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox