mirror of
https://github.com/certbot/certbot.git
synced 2026-08-04 12:32:02 +02:00
Fix certbot.compat.os docs (#8209)
* Don't document stdlib os. * Move isort out of docstring. * fix os import * fix comment length
This commit is contained in:
@@ -3,8 +3,11 @@ This compat modules is a wrapper of the core os module that forbids usage of spe
|
|||||||
(e.g. chown, chmod, getuid) that would be harmful to the Windows file security model of Certbot.
|
(e.g. chown, chmod, getuid) that would be harmful to the Windows file security model of Certbot.
|
||||||
This module is intended to replace standard os module throughout certbot projects (except acme).
|
This module is intended to replace standard os module throughout certbot projects (except acme).
|
||||||
|
|
||||||
isort:skip_file
|
This module has the same API as the os module in the Python standard library
|
||||||
|
except for the functions defined below.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# isort:skip_file
|
||||||
# pylint: disable=function-redefined
|
# pylint: disable=function-redefined
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
@@ -21,10 +24,13 @@ import os as std_os # pylint: disable=os-module-forbidden
|
|||||||
import sys as std_sys
|
import sys as std_sys
|
||||||
|
|
||||||
ourselves = std_sys.modules[__name__]
|
ourselves = std_sys.modules[__name__]
|
||||||
|
# Adding all of stdlib os to this module confuses Sphinx so we skip this when
|
||||||
|
# building the documentation.
|
||||||
|
if not std_os.environ.get("CERTBOT_DOCS") == "1":
|
||||||
for attribute in dir(std_os):
|
for attribute in dir(std_os):
|
||||||
# Check if the attribute does not already exist in our module. It could be internal attributes
|
# Check if the attribute does not already exist in our module. It could
|
||||||
# of the module (__name__, __doc__), or attributes from standard os already imported with
|
# be internal attributes of the module (__name__, __doc__), or
|
||||||
# `from os import *`.
|
# attributes from standard os already imported with `from os import *`.
|
||||||
if not hasattr(ourselves, attribute):
|
if not hasattr(ourselves, attribute):
|
||||||
setattr(ourselves, attribute, getattr(std_os, attribute))
|
setattr(ourselves, attribute, getattr(std_os, attribute))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user