> +from logging import root
> +import os
> +import re

The logging and re imports are unused, remove these.

> +
> +
> +html_content = '''
> +<div id="outdated-warning">This document is outdated, you should select the 
> <a href="https://docs.yoctoproject.org/";>latest release version</a> in this 
> series.</div>
> +<div xml:lang="en" class="body" lang="en">
> +'''
> +last_div = '''
> +</div>

Add a comment explaining why you need to add a <div> wrapping the main content.

> +    # pattern = '^3.1*'
> +    # exclude = re.search(pattern, dir)
> +def loop_through_html_directories(dir):
> +    for root, dirs, filenames in os.walk(dir, topdown=True):
> +        # loop through all files in the directory
> +        exclude = set(['3.1', '3.1.1', '3.1.2', '3.1.3'])

Hardcoding numbers like this isn’t a great idea.  If the intention is to add 
the warning on all versions earlier than 3.2, then the regex approach that is 
commented out would be better.  It most likely didn’t work as regex matching 
isn’t like shell/windows matching:

pattern = r”^3\.1.*"

A good solution would be to use packaging.version.parse, but that’s not a 
built-in module so would need to be added to the build. That can wait, the 
regex solution should be good.

A comment here explaining what the exclusion is for, and why 3.1, would be good.

> +        dirs[:] = list(filter(lambda x: not x in exclude, dirs))
> +        for filename in filenames:
> +            # check if the file is an html file

No need for obvious comments

> +            if filename.endswith('.html'):
> +                # open the html file in read mode

Obvious comment, again, and several times below.

Ross
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#56875): https://lists.yoctoproject.org/g/yocto/message/56875
Mute This Topic: https://lists.yoctoproject.org/mt/90655998/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to