[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD4GDZwLW0yogWitN5vbfkDhpZZ=0YCnDh+taRzwnv_CY9Miag@mail.gmail.com>
Date: Fri, 13 Jun 2025 13:53:40 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc: Linux Doc Mailing List <linux-doc@...r.kernel.org>, Jonathan Corbet <corbet@....net>,
Akira Yokosawa <akiyks@...il.com>, Breno Leitao <leitao@...ian.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Ignacio Encinas Rubio <ignacio@...cinas.com>, Jan Stancek <jstancek@...hat.com>,
Marco Elver <elver@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Ruben Wauters <rubenru09@....com>,
Shuah Khan <skhan@...uxfoundation.org>, joel@...lfernandes.org,
linux-kernel-mentees@...ts.linux.dev, linux-kernel@...r.kernel.org,
lkmm@...ts.linux.dev, netdev@...r.kernel.org, peterz@...radead.org,
stern@...land.harvard.edu
Subject: Re: [PATCH v2 06/12] scripts: lib: netlink_yml_parser.py: use classes
On Fri, 13 Jun 2025 at 13:40, Mauro Carvalho Chehab
<mchehab+huawei@...nel.org> wrote:
>
> Em Fri, 13 Jun 2025 12:20:33 +0100
> Donald Hunter <donald.hunter@...il.com> escreveu:
>
> > Mauro Carvalho Chehab <mchehab+huawei@...nel.org> writes:
> >
> > > As we'll be importing netlink parser into a Sphinx extension,
> > > move all functions and global variables inside two classes:
> > >
> > > - RstFormatters, containing ReST formatter logic, which are
> > > YAML independent;
> > > - NetlinkYamlParser: contains the actual parser classes. That's
> > > the only class that needs to be imported by the script or by
> > > a Sphinx extension.
> >
> > I suggest a third class for the doc generator that is separate from the
> > yaml parsing.
>
> Do you mean moving those two (or three? [*]) methods to a new class?
>
> def parse_yaml(self, obj: Dict[str, Any]) -> str:
> def parse_yaml_file(self, filename: str) -> str:
> def generate_main_index_rst(self, output: str, index_dir: str) -> None:
>
> Also, how should I name it to avoid confusion with NetlinkYamlParser?
> Maybe YnlParser?
On second thoughts, I see that the rst generation is actually spread
through all the parse_* methods so they are all related to doc generation.
I suggest putting all the parse_* methods into a class called
YnlDocGenerator, so just the 2 classes.
And I'm hoping that generate_main_index_rst can be removed.
> [*] generate_main_index_rst is probably deprecated. eventually
> we may drop it or keep it just at the command line stript.
>
> > The yaml parsing should really be refactored to reuse
> > tools/net/ynl/pyynl/lib/nlspec.py at some point.
>
> Makes sense, but such change is out of the scope of this series.
Agreed
Thanks,
Donald.
Powered by blists - more mailing lists