openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #32033
Re: [Merge] lp:~phill-ridout/openlp/pathlib4 into lp:openlp
Review: Needs Fixing
Minor tweak
Diff comments:
>
> === modified file 'openlp/core/common/path.py'
> --- openlp/core/common/path.py 2017-08-04 17:40:57 +0000
> +++ openlp/core/common/path.py 2017-08-26 18:16:16 +0000
> @@ -19,17 +19,23 @@
> # with this program; if not, write to the Free Software Foundation, Inc., 59 #
> # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
> ###############################################################################
> -
> -from pathlib import Path
> -
> -
> -def path_to_str(path):
> +import pathlib
> +from contextlib import suppress
> +
> +from openlp.core.common import is_win
> +
> +
> +if is_win():
> + path_variant = pathlib.WindowsPath
> +else:
> + path_variant = pathlib.PosixPath
Rather do something like this:
if is_win():
from pathlib import WindowsPath as Path # Or "ParentPath" or "FixedPath" or something
else:
from pathlib import PosixPath as Path # Or "ParentPath" or "FixedPath" or something
> +
> +
> +def path_to_str(path=None):
> """
> A utility function to convert a Path object or NoneType to a string equivalent.
>
> - :param path: The value to convert to a string
> - :type: pathlib.Path or None
> -
> + :param openlp.core.common.path.Path | None path: The value to convert to a string
> :return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
> :rtype: str
> """
--
https://code.launchpad.net/~phill-ridout/openlp/pathlib4/+merge/329676
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/pathlib4 into lp:openlp.
References