Updated for tuple

This commit is contained in:
Dimitris Zlatanidis 2023-05-08 20:48:56 +03:00
parent 1eea85cbec
commit 497a5b0fc3
2 changed files with 7 additions and 7 deletions

View file

@ -26,14 +26,14 @@ class Required:
self.repo: str = data[name][11] self.repo: str = data[name][11]
def resolve(self) -> list: def resolve(self) -> tuple:
""" Resolve the dependencies. """ """ Resolve the dependencies. """
required: list[str] = list(self.remove_deps(self.data[self.name][6].split())) required: list[str] = list(self.remove_deps(self.data[self.name][6].split()))
# Resolve dependencies for some special repos. # Resolve dependencies for some special repos.
if self.repo in self.special_repos: if self.repo in self.special_repos:
for req in required: for req in required:
if req not in list(self.data.keys()): if req not in tuple(self.data.keys()):
required.remove(req) required.remove(req)
else: else:
@ -43,10 +43,10 @@ class Required:
required.append(sub) required.append(sub)
required.reverse() required.reverse()
return list(dict.fromkeys(required)) return tuple(dict.fromkeys(required))
def remove_deps(self, requires: list) -> Generator: def remove_deps(self, requires: list) -> Generator:
""" Remove requires that not in the repository or blacklisted. """ """ Remove requires that not in the repository or blacklisted. """
for dep in requires: for dep in requires:
if dep in list(self.data.keys()): if dep in tuple(self.data.keys()):
yield dep yield dep

View file

@ -13,7 +13,7 @@ class Requires:
self.data: dict = data self.data: dict = data
self.name: str = name self.name: str = name
def resolve(self) -> list: def resolve(self) -> tuple:
""" Resolve the dependencies. """ """ Resolve the dependencies. """
requires: list[str] = list(self.remove_deps(self.data[self.name][7].split())) requires: list[str] = list(self.remove_deps(self.data[self.name][7].split()))
@ -24,10 +24,10 @@ class Requires:
requires.reverse() requires.reverse()
return list(dict.fromkeys(requires)) return tuple(dict.fromkeys(requires))
def remove_deps(self, requires: list) -> Generator: def remove_deps(self, requires: list) -> Generator:
""" Remove requires that not in the repository or blacklisted. """ """ Remove requires that not in the repository or blacklisted. """
for dep in requires: for dep in requires:
if dep in list(self.data.keys()): if dep in tuple(self.data.keys()):
yield dep yield dep