Project

General

Profile

Bug #74065

pylint 2.16 : beaucoup de R1735(use-dict-literal)

Added by Thomas Noël about 1 year ago. Updated about 1 year ago.

Status:
Fermé
Priority:
Normal
Category:
-
Target version:
-
Start date:
01 February 2023
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:
No

Description

Sur le nouveau pylint 2.16 est relevé l'usage de dict(...), voir ci-dessous.

Soit il faut corriger le code, soit ajouter des #noqa, soit use-dict-literal ignorer dans pylintrc.

Je préfère laisser la main sur ce sujet à quelqu'un de plus légitime que moi sur le code d'Authentic.

************* Module tests.test_idp_saml2
tests/test_idp_saml2.py:220: [R1735(use-dict-literal), SamlSP.get_metadata] Consider using '{"base_url": self.base_url, "binding": self.binding, "keys": self.keys, ... }' instead of a call to 'dict'.
tests/test_idp_saml2.py:543: [R1735(use-dict-literal), test_sso_redirect_post] Consider using '{"binding": 'post'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:552: [R1735(use-dict-literal), test_sso_post_post] Consider using '{"binding": 'post'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:561: [R1735(use-dict-literal), test_sso_redirect_artifact] Consider using '{"binding": 'artifact', "keys": keys}' instead of a call to 'dict'.
tests/test_idp_saml2.py:577: [R1735(use-dict-literal), test_sso_no_name_id_policy_redirect] Consider using '{"name_id_policy": False}' instead of a call to 'dict'.
tests/test_idp_saml2.py:587: [R1735(use-dict-literal), test_sso_nid_username] Consider using '{"default_name_id_format": 'username'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:588: [R1735(use-dict-literal), test_sso_nid_username] Consider using '{"name_id_policy": False}' instead of a call to 'dict'.
tests/test_idp_saml2.py:600: [R1735(use-dict-literal), test_sso_nid_uuid] Consider using '{"default_name_id_format": 'uuid'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:601: [R1735(use-dict-literal), test_sso_nid_uuid] Consider using '{"name_id_policy": False}' instead of a call to 'dict'.
tests/test_idp_saml2.py:637: [R1735(use-dict-literal), test_sso_redirect_artifact_login_hints] Consider using '{"binding": 'artifact', "keys": keys}' instead of a call to 'dict'.
tests/test_idp_saml2.py:650: [R1735(use-dict-literal), test_sso_redirect_artifact_next_url] Consider using '{"binding": 'artifact', "keys": keys}' instead of a call to 'dict'.
************* Module tests.test_utils_evaluate
tests/test_utils_evaluate.py:87: [R1735(use-dict-literal), test_evaluate_condition] Consider using '{"a": True, "b": False}' instead of a call to 'dict'.
tests/test_utils_evaluate.py:88: [R1735(use-dict-literal), test_evaluate_condition] Consider using '{"a": 0}' instead of a call to 'dict'.
************* Module tests.test_data_transfer
tests/test_data_transfer.py:241: [R1735(use-dict-literal), test_role_deserializer_with_attributes] Consider using '{"name": 'is_superuser', "kind": 'string', "value": 'true'}' instead of a call to 'dict'.
tests/test_data_transfer.py:242: [R1735(use-dict-literal), test_role_deserializer_with_attributes] Consider using '{"name": 'emails', "kind": 'json', "value": '["a@a.com"]'}' instead of a call to 'dict'.
************* Module tests.test_import_export_site_cmd
tests/test_import_export_site_cmd.py:93: [W0719(broad-exception-raised), test_import_site_transaction_rollback_on_error.exception_import_site] Raising too general exception: Exception
************* Module tests.idp_oidc.conftest
tests/idp_oidc/conftest.py:88: [R1735(use-dict-literal), make_client] Consider using '{"label": 'cityscape', "kind": 'profile_image', "asked_on_registration": True, ... }' instead of a call to 'dict'.
************* Module src.authentic2.app_settings
src/authentic2/app_settings.py:96: [R1735(use-dict-literal), ] Consider using '{"ATTRIBUTE_BACKENDS": Setting(names=('A2_ATTRIBUTE_BACKENDS', ), default=('authentic2.attributes_ng.sources.format', 'authentic2.attributes_ng.sources.function', 'authentic2.attributes_ng.sources.django_user', 'authentic2.attributes_ng.sources.ldap', 'authentic2.attributes_ng.sources.service_roles'), definition='List of attribute backend classes or modules'), ... }' instead of a call to 'dict'.
************* Module src.authentic2.idp.saml.app_settings
src/authentic2/idp/saml/app_settings.py:21: [R1735(use-dict-literal), AppSettings] Consider using '{"ENABLE": False, "METADATA_OPTIONS": {}, "SECONDS_TOLERANCE": 60}' instead of a call to 'dict'.
************* Module src.authentic2.idp.saml.saml2_endpoints
src/authentic2/idp/saml/saml2_endpoints.py:430: [W0719(broad-exception-raised), build_assertion] Raising too general exception: Exception
************* Module src.authentic2.a2_rbac.management
src/authentic2/a2_rbac/management.py:117: [R1735(use-dict-literal), update_content_types_roles] Consider using '{"name": gettext('Manager')}' instead of a call to 'dict'.
************* Module src.authentic2.a2_rbac.app_settings
src/authentic2/a2_rbac/app_settings.py:21: [R1735(use-dict-literal), AppSettings] Consider using '{"MANAGED_CONTENT_TYPES": None, "ROLE_ADMIN_RESTRICT_TO_OU_USERS": False, ... }' instead of a call to 'dict'.
************* Module src.authentic2.forms.widgets
src/authentic2/forms/widgets.py:176: [R1735(use-dict-literal), PickerWidgetMixin.render] Consider using '{"id": id, "rendered_widget": rendered_widget, "clear_button": CLEAR_BTN_TEMPLATE if self.options.get('clearBtn') else '', ... }' instead of a call to 'dict'.
************* Module src.authentic2.saml.common
src/authentic2/saml/common.py:133: [W0719(broad-exception-raised), create_saml2_server] Raising too general exception: Exception
src/authentic2/saml/common.py:455: [W0719(broad-exception-raised), lookup_federation_by_user] Raising too general exception: Exception
************* Module src.authentic2.saml.x509utils
src/authentic2/saml/x509utils.py:95: [W0719(broad-exception-raised), generate_rsa_keypair] Raising too general exception: Exception
src/authentic2/saml/x509utils.py:98: [W0719(broad-exception-raised), generate_rsa_keypair] Raising too general exception: Exception
************* Module src.authentic2.disco_service.disco_responder
src/authentic2/disco_service/disco_responder.py:196: [R1735(use-dict-literal), disco] Consider using '{"return_url": return_url, "entity_id": entityID}' instead of a call to 'dict'.
************* Module src.authentic2.backends.ldap_backend
src/authentic2/backends/ldap_backend.py:435: [E0601(used-before-assignment), LDAPUser.save] Using variable 'pk' before assignment
************* Module src.authentic2.apps.journal.models
src/authentic2/apps/journal/models.py:65: [C0204(bad-mcs-classmethod-argument), EventTypeDefinitionMeta.__new__] Metaclass class method __new__ should have 'mcs' as first argument
************* Module src.authentic2_auth_oidc.utils
src/authentic2_auth_oidc/utils.py:260: [R1735(use-dict-literal), register_issuer] Consider using '{"ou": ou or get_default_ou(), "name": name, "issuer": openid_configuration['issuer'], ... }' instead of a call to 'dict'.

Files

Associated revisions

Revision 03c44502 (diff)
Added by Paul Marillonnet about 1 year ago

pylint.rc: ignore use-dict-literal (R1735) error (#74065)

Revision 3e32808e (diff)
Added by Paul Marillonnet about 1 year ago

codestyle: fix metaclass constructor's first argument name (#74065)

Revision 70efa06a (diff)
Added by Paul Marillonnet about 1 year ago

pylint: disable error on seemingly used-before-assigned variable (#74065)

History

#1

Updated by Paul Marillonnet about 1 year ago

  • Status changed from Nouveau to En cours
  • Assignee set to Paul Marillonnet
#3

Updated by Frédéric Péters about 1 year ago

  • Status changed from Solution proposée to Solution validée

Pas enthousiaste sur la désactivation globale de use-dict-literal. (parce qu'à la base pas fan de l'emploi de la forme dict(a=b, c=d) pour créer des dictionnaires, et que c'était l'occasion de dégager ça), mais je regardais si pyupgrade pouvait faire le changement automatiquement et ça n'est pas le cas, donc en attendant que peut-être ça vienne, go ainsi plutôt que le taf barbant.

#4

Updated by Paul Marillonnet about 1 year ago

  • Status changed from Solution validée to Résolu (à déployer)
commit 70efa06a304058011bbe95331869912b70aa2bb5
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date:   Fri Feb 3 09:22:22 2023 +0100

    pylint: disable error on seemingly used-before-assigned variable (#74065)

commit 3e32808e606ef6e85d256b1c1bad17316ba27668
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date:   Fri Feb 3 09:21:43 2023 +0100

    codestyle: fix metaclass constructor's first argument name (#74065)

commit 03c44502d30cb10d306b8eacac14f63caea04f3f
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date:   Fri Feb 3 08:37:43 2023 +0100

    pylint.rc: ignore use-dict-literal (R1735) error (#74065)
#5

Updated by Transition automatique about 1 year ago

  • Status changed from Résolu (à déployer) to Solution déployée
#6

Updated by Transition automatique about 1 year ago

Automatic expiration

Also available in: Atom PDF