From 5cb708efb9139d0c5ccad196f9251efb0331e186 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 29 Apr 2024 15:32:42 +0200 Subject: [PATCH] python: remove more six crumbs (#3675) --- gui/wxpython/gmodeler/panels.py | 5 ++--- .../modules/interface/testsuite/test_modules.py | 16 +--------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/gui/wxpython/gmodeler/panels.py b/gui/wxpython/gmodeler/panels.py index 1e650ffaa1c..76a5237448e 100644 --- a/gui/wxpython/gmodeler/panels.py +++ b/gui/wxpython/gmodeler/panels.py @@ -23,7 +23,6 @@ import stat import tempfile import random -import six import math import wx @@ -1227,7 +1226,7 @@ def OnModelProperties(self, event): dlg.Init(properties) if dlg.ShowModal() == wx.ID_OK: self.ModelChanged() - for key, value in six.iteritems(dlg.GetValues()): + for key, value in dlg.GetValues().items(): properties[key] = value for action in self.model.GetItems(objType=ModelAction): action.GetTask().set_flag("overwrite", properties["overwrite"]) @@ -1459,7 +1458,7 @@ def OnAdd(self, event): def UpdateModelVariables(self): """Update model variables""" variables = dict() - for values in six.itervalues(self.list.GetData()): + for values in self.list.GetData().values(): name = values[0] variables[name] = {"type": str(values[1])} if values[2]: diff --git a/python/grass/pygrass/modules/interface/testsuite/test_modules.py b/python/grass/pygrass/modules/interface/testsuite/test_modules.py index d95bf6177af..3318154f87d 100644 --- a/python/grass/pygrass/modules/interface/testsuite/test_modules.py +++ b/python/grass/pygrass/modules/interface/testsuite/test_modules.py @@ -20,20 +20,6 @@ ] -# taken from six -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(meta): - def __new__(cls, name, this_bases, d): - return meta(name, bases, d) - - return type.__new__(metaclass, "temporary_class", (), {}) - - class ModulesMeta(type): def __new__(mcs, name, bases, dict): def gen_test(cmd): @@ -53,7 +39,7 @@ def test(self): return type.__new__(mcs, name, bases, dict) -class TestModules(with_metaclass(ModulesMeta, TestCase)): +class TestModules(TestCase, metaclass=ModulesMeta): pass