Skip to content

Commit

Permalink
[autofix] Format Python
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed May 15, 2022
1 parent 3a70bff commit 6c3ef10
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
11 changes: 6 additions & 5 deletions meta_package_manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,14 @@ def outdated(self):
"""
raise NotImplementedError


def refilter(self, results, query, extended, exact):
"""Manually refilters search results against ``extended`` and ``exact`` parameters.
"""Manually refilters search results against ``extended`` and ``exact``
parameters.
Some package managers returns unbounded search results, and don't support finer search criterions.
In which case we consider the results as extended by default, and use this method to manually refilters
results to either exclude non-extended or non-exact matches.
Some package managers returns unbounded search results, and don't support finer
search criterions. In which case we consider the results as extended by default,
and use this method to manually refilters results to either exclude non-extended
or non-exact matches.
"""
for package_id, version, description in results:

Expand Down
7 changes: 6 additions & 1 deletion meta_package_manager/managers/apm.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,12 @@ def search(self, query, extended, exact):

if output:

for package_id, version, description in self.refilter(map(itemgetter("name", "version", "description"), json.loads(output)), query, extended, exact):
for package_id, version, description in self.refilter(
map(itemgetter("name", "version", "description"), json.loads(output)),
query,
extended,
exact,
):

matches[package_id] = {
"id": package_id,
Expand Down
4 changes: 3 additions & 1 deletion meta_package_manager/managers/cargo.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def search(self, query, extended, exact):
re.MULTILINE,
)

for package_id, version, description in self.refilter(regexp.findall(output), query, extended, exact):
for package_id, version, description in self.refilter(
regexp.findall(output), query, extended, exact
):

matches[package_id] = {
"id": package_id,
Expand Down
7 changes: 6 additions & 1 deletion meta_package_manager/managers/npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ def search(self, query, extended, exact):

if output:

for package_id, version, description in self.refilter(map(itemgetter("name", "version", "description"), json.loads(output)), query, extended, exact):
for package_id, version, description in self.refilter(
map(itemgetter("name", "version", "description"), json.loads(output)),
query,
extended,
exact,
):

matches[package_id] = {
"id": package_id,
Expand Down
4 changes: 3 additions & 1 deletion meta_package_manager/managers/opkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def search(self, query, extended, exact):
re.VERBOSE | re.MULTILINE,
)

for package_id, version, description in self.refilter(regexp.findall(output), query, extended, exact):
for package_id, version, description in self.refilter(
regexp.findall(output), query, extended, exact
):

matches[package_id] = {
"id": package_id,
Expand Down
4 changes: 3 additions & 1 deletion meta_package_manager/managers/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ def search_xxx_disabled(self, query, extended, exact):
re.MULTILINE | re.VERBOSE,
)

for package_id, version, description in self.refilter(regexp.findall(output), query, extended, exact):
for package_id, version, description in self.refilter(
regexp.findall(output), query, extended, exact
):

matches[package_id] = {
"id": package_id,
Expand Down
4 changes: 3 additions & 1 deletion meta_package_manager/managers/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def search(self, query, extended, exact):
re.MULTILINE,
)

for package_id, version, description in self.refilter(regexp.findall(output.split('\n', 1)[1]), query, extended, exact):
for package_id, version, description in self.refilter(
regexp.findall(output.split("\n", 1)[1]), query, extended, exact
):

matches[package_id] = {
"id": package_id,
Expand Down

0 comments on commit 6c3ef10

Please sign in to comment.