Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwIQO-0006aB-9c for pgadmin-hackers@arkaria.postgresql.org; Thu, 24 Jun 2021 06:01:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwIQN-0006jl-8H for pgadmin-hackers@arkaria.postgresql.org; Thu, 24 Jun 2021 06:01:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwIQM-0006jd-VS for pgadmin-hackers@lists.postgresql.org; Thu, 24 Jun 2021 06:01:15 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lwIQK-0000M5-BG for pgadmin-hackers@postgresql.org; Thu, 24 Jun 2021 06:01:14 +0000 Received: by mail-il1-x12d.google.com with SMTP id i12so4923980ila.13 for ; Wed, 23 Jun 2021 23:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZZJDv05Yei1EALqY62qIffR4WPqomUH+iszOgP95I4k=; b=cQaWuXT38Z6wGA9VLiRmPUU9tHKMoyPKD2EPH+l04OXMJUi6cJeB5hql1M+OlYP8a8 okfbHXIgcgRTUPuPiqBBms/tIC2Wpxxr3JoAVK3xS0CrR6WmQ6FGTI4sk1vIt+kp3NSA pVq+cqQUR8yl/Qt1zH8vJoL91QOgkvILsFEWzNCXG0GJWRVyc1yT2CGCJw3E7M0bmPil Pn0eH4ooGbkybQpzGjvxRYGHrTQ1wMcALe1rrM2PHq5fDSWEUriWWUHe5k/f2Zbl+KJt jBzXZJIHJGOKV9jS+LQhRnQt/kmEuGMSmDqq+yTsiZjTUcfRrQVP3X1/PXcYWlxntcvz KObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZZJDv05Yei1EALqY62qIffR4WPqomUH+iszOgP95I4k=; b=GmyVO25QqTTAjM+aS2d50zMDwJbzrvkp2Dyen2+7MbTWga35P1fc+9qA2I9cwFxIWn EV70OgH6ChniErrdtDWbEFrdsqUQm9kjH6Ebdx/J6ocuMM+mawDnt7EViRO2DADMBzuZ ITqK62ZOlaJINeUUufSJFxu4/Q96NlY/HTC5iRurJQhHUdVYtpwUS2JK6gnTVn54tB+C W+feUxKxH5z68txfcWJGQqqufRI/j9drmoHY9Wqz2V9L5eIph7T4mw3IPkzNntHVSNQb mnSFsQ5D2vmqsENhbfAxV0DhfXGAyWTRdYV28V6R87KvSI5nlRDCmn3WC+GsSUTY13Gn m6BA== X-Gm-Message-State: AOAM5338VPpbT4ESzixYj/PVJjDoNGrVmQPXHIJJdSBC3u4ewd4xwLkK K/sdl7Lgn4FwWv93nv8N261SNaq3qSUkn6unNE0ShMVXBChoTZ5Lsv6FSNSn9ZnJY1DTsC5n9bD REvrcfYMfB+Bkt4RUZC9ksNtfFhVGh23Tugv7dBjmorS7g9L9CNOsjmP1M51JqRTPbrJnF8tD+I erAyQFFcC+TnSdKsc/wjcazE7XSaIDoGnwoVO9+SgOA7zxP+9lHv2QQqL9ZA== X-Google-Smtp-Source: ABdhPJwfE7tUP9AmUclbK2sKxlmk6AixCIVhrzT+JBaXcGU0GtYvi60FQM6+UDP+U+XGkMr1/+v7C/QVUauvTVbbCwc= X-Received: by 2002:a05:6e02:1a4c:: with SMTP id u12mr2394314ilv.176.1624514470038; Wed, 23 Jun 2021 23:01:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Akshay Joshi Date: Thu, 24 Jun 2021 11:30:59 +0530 Message-ID: Subject: Re: Refactor: Registry Classes To: Ashesh Vashi Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000eb708d05c57cbf15" X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000eb708d05c57cbf15 Content-Type: text/plain; charset="UTF-8" Thanks, the patch applied. On Wed, Jun 23, 2021 at 7:54 PM Ashesh Vashi wrote: > On Wed, Jun 23, 2021 at 1:22 PM Akshay Joshi < > akshay.joshi@enterprisedb.com> wrote: > >> Hi Ashesh >> >> Following are the review comments: >> >> - Fixed PEP8 issues. >> >> Done. > >> >> - In "dynamic_registry/__init__.py" decorator @classmethod used for " >> *_get*" and "*_load_modules*" methods which are actually outside of >> the class. Even constructor also outside of the class. >> >> 'create_registry_metaclass' is not a class, but a method to create the > dynamic classes. > If I move these methods in 'create_registry_metaclass' method, SonarQube > raises issues about complexity of the functions, hence - they're best kept > outside of that method. > >> >> - Remove unused imports from "driver/registry.py" >> >> Done > >> >> - >> - Fixed sonarqube issues in >> "dynamic_registry/tests/registry/__init__.py" >> >> Done > As discussed, SonarQube is not able to understand that the result object > is a class, and not an object, hence - showing linter issues. > I've disabled them in those lines by adding the comment '# NOSNAR' at the > end. > > -- Thanks, Ashesh > >> >> On Sat, Jun 19, 2021 at 11:27 AM Ashesh Vashi < >> ashesh.vashi@enterprisedb.com> wrote: >> >>> On Sat, Jun 19, 2021 at 1:39 AM Ashesh Vashi < >>> ashesh.vashi@enterprisedb.com> wrote: >>> >>>> Hi Akshay, >>>> >>>> We do have a couple of classes, which does automatic registration of >>>> the base classes, >>>> and which creates single-ton objects for these base classes, when >>>> needed. >>>> >>>> I would be working on a patch sooner, which will be using similar >>>> functionality for loading >>>> the multi-factor authentication. >>>> >>>> I realized - it will be a duplicate code at three places for the same >>>> functionalities. >>>> Hence - I worked on refactoring this registry class. >>>> >>>> Please find the patch for the same. >>>> >>> Found issues - some test files were using the old function >>> 'Driver.load_drivers(...)'. >>> They're fixed now. >>> >>> -- Thanks, Ashesh >>> >>>> >>>> -- >>>> >>>> Thanks & Regards, >>>> >>>> Ashesh Vashi >>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company >>>> >>>> >>>> >>>> *http://www.linkedin.com/in/asheshvashi* >>>> >>>> >>> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> *pgAdmin Hacker | Principal Software Architect* >> *EDB Postgres * >> >> *Mobile: +91 976-788-8246* >> > -- *Thanks & Regards* *Akshay Joshi* *pgAdmin Hacker | Principal Software Architect* *EDB Postgres * *Mobile: +91 976-788-8246* --000000000000eb708d05c57cbf15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, the patch applied.

On Wed, Jun 23, 2021 at 7:54 PM = Ashesh Vashi <ashesh.va= shi@enterprisedb.com> wrote:
On Wed, Jun 23, 2021 = at 1:22 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
<= div class=3D"gmail_quote">
Hi=C2=A0Ashesh

Following are the revie= w comments:
  • Fixed PEP8 issues.
Done.
<= div dir=3D"ltr">
  • In "dynamic_registry/__init__.py" de= corator @classmethod used for "_get" and "_load_mo= dules" methods which are actually outside of the class. Even const= ructor also outside of the class.
'create_registry_metaclass' is not a class, but a method to creat= e the dynamic classes.
If I move these methods in 'create_reg= istry_metaclass' method, SonarQube raises issues about complexity of th= e functions, hence - they're best kept outside of that method.=C2=A0
    <= li>Remove unused imports from "driver/registry.py"
<= /div>
Done
  • Fixed sonarqube issues in "d= ynamic_registry/tests/registry/__init__.py"
Done
As discussed, SonarQube is not able to understand= that the result object is a class, and not an object, hence - showing lint= er issues.
I've disabled them in those lines by adding th= e comment '# NOSNAR' at the end.

-- Thanks= , Ashesh

On Sat, Jun 19, 2= 021 at 11:27 AM Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
On Sat, Jun 19, 2021 at 1:39 AM Ashesh Vashi <ashesh.vashi@enterpri= sedb.com> wrote:
Hi Akshay,

We do have a couple of classes, which does automatic registration of= the base classes,
and which creates single-ton objects for these= base classes, when needed.

I would be working on = a patch sooner, which will be using similar functionality for loading
=
the multi-factor authentication.

I realized -= it will be a duplicate code at three places for the same functionalities.<= /div>
Hence - I worked on refactoring this registry class.
Please find the patch for the same.=C2=A0
Found issues - some test files were using the old function 'Dr= iver.load_drivers(...)'.
They're fixed now.
-- Thanks, Ashesh

--

<= p style=3D"margin:0pt">Thanks & Regards,

<= span style=3D"font-style:italic">Ashesh Vashi

EnterpriseDB INDIA: Enterprise PostgreSQL = Company


http://www.linkedin.com/in/asheshvashi



--
Thank= s & Regards
Akshay Joshi
pgAdmin Hacker | Principal Softw= are Architect
EDB Po= stgres
Mobile: +91 976-788-8246



--
Thanks & Regards
Akshay Joshi
pgAdmi= n Hacker | Principal Software Architect
EDB Postgres
Mobile: +91 976-788-8246

--000000000000eb708d05c57cbf15--