From: Collin Funk Date: Thu, 4 Apr 2024 22:29:50 +0000 (-0700) Subject: gnulib-tool.py: Ignore 'use-dict-literal' warnings. X-Git-Tag: v1.0~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4b2df9d5ae1056fcecab7ca1583fb76ac99ed67;p=thirdparty%2Fgnulib.git gnulib-tool.py: Ignore 'use-dict-literal' warnings. * pygnulib/.pylintrc: Don't emit warning messages suggesting that 'dict()' be converted to '{}'. This literal can be mistaken for sets, see discussion here: * pygnulib/main.py: Document this convention in coding style section. * pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Convert an occurrence of '{}' to 'dict()'. --- diff --git a/ChangeLog b/ChangeLog index 3cceb4c60a..5a84f5a2c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2024-04-04 Collin Funk + + gnulib-tool.py: Ignore 'use-dict-literal' warnings. + * pygnulib/.pylintrc: Don't emit warning messages suggesting that + 'dict()' be converted to '{}'. This literal can be mistaken for sets, + see discussion here: + + * pygnulib/main.py: Document this convention in coding style section. + * pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Convert an + occurrence of '{}' to 'dict()'. + 2024-04-04 Collin Funk gnulib-tool.py: Fix pylint 'raise-missing-from' warnings. diff --git a/pygnulib/.pylintrc b/pygnulib/.pylintrc index 15e2e8e800..102accb37d 100644 --- a/pygnulib/.pylintrc +++ b/pygnulib/.pylintrc @@ -1,7 +1,7 @@ # .pylintrc [MESSAGES CONTROL] -disable=C0103,C0114,C0121,C0123,C0209,C0301,C0302,R0902,R0912,R0913,R0914,R0915,R1705,R1702,R1720 +disable=C0103,C0114,C0121,C0123,C0209,C0301,C0302,R0902,R0912,R0913,R0914,R0915,R1705,R1702,R1720,R1735 # Local Variables: # mode: conf diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py index e157578e54..551ae177e4 100644 --- a/pygnulib/GLFileSystem.py +++ b/pygnulib/GLFileSystem.py @@ -154,7 +154,7 @@ class GLFileSystem: class GLFileAssistant: '''GLFileAssistant is used to help with file processing.''' - def __init__(self, config: GLConfig, transformers: dict[str, tuple[re.Pattern, str] | None] = {}) -> None: + def __init__(self, config: GLConfig, transformers: dict[str, tuple[re.Pattern, str] | None] = dict()) -> None: '''Create GLFileAssistant instance. config stores information shared between classes. diff --git a/pygnulib/main.py b/pygnulib/main.py index 233c79182e..4bf4da4279 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -52,6 +52,8 @@ # - Prefer the standard collection type hints over those provided in the # typing module. The latter are deprecated and may be removed. # Cf. . +# - Never use the {} literal, because it denotes a dictionary, +# as opposed to {x}, {x,y}, etc., which denote sets. # You can use this command to check the style: # $ pycodestyle *.py