Replace exec() to getattr()

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-02-14 22:01:39 +01:00
parent 9f1b0920ca
commit e5eb0e7b0d

View file

@ -41,9 +41,9 @@ class RepoInit:
def fetch(self): def fetch(self):
if self.repo in self.meta.default_repositories: if self.repo in self.meta.default_repositories:
exec(f"self._init_{self.repo}()") getattr(self, f"_init_{self.repo}")()
else: else:
exec("self._init_custom()") self._init_custom()
self.lib = self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT" self.lib = self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT"
PACKAGES_TXT = Utils().read_file(self.lib) PACKAGES_TXT = Utils().read_file(self.lib)
return PACKAGES_TXT, self.mirror return PACKAGES_TXT, self.mirror