Skip to content

Commit

Permalink
style(pylint): 2.6.0 release - fix W0707
Browse files Browse the repository at this point in the history
  • Loading branch information
actionless committed Sep 17, 2020
1 parent ffaeaad commit 4cd16ef
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions pikaur/install_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def get_all_packages_info(self) -> None: # pylint:disable=too-many-branches
self.get_all_packages_info()
return
print_not_found_packages(exc.packages)
raise SysExit(131)
raise SysExit(131) from exc
except DependencyVersionMismatch as exc:
print_stderr(color_line(_("Version mismatch:"), 11))
print_stderr(
Expand All @@ -274,7 +274,7 @@ def get_all_packages_info(self) -> None: # pylint:disable=too-many-branches
version=exc.version_found,
)
)
raise SysExit(131)
raise SysExit(131) from exc

if self.args.repo and self.not_found_repo_pkgs_names:
print_not_found_packages(self.not_found_repo_pkgs_names, repo=True)
Expand Down Expand Up @@ -531,7 +531,7 @@ def _clone_aur_repos(self, package_names: List[str]) -> Optional[Dict[str, Packa
for skip_pkg_name in package_build.package_names:
self.discard_install_info(skip_pkg_name)
else:
raise SysExit(125)
raise SysExit(125) from err

def get_package_builds(self) -> None: # pylint: disable=too-many-branches
while self.all_aur_packages_names:
Expand Down Expand Up @@ -846,7 +846,7 @@ def build_packages(self) -> None: # pylint: disable=too-many-branches
for remaining_aur_pkg_name in packages_to_be_built[:]:
if remaining_aur_pkg_name not in self.all_aur_packages_names:
packages_to_be_built.remove(remaining_aur_pkg_name)
except DependencyNotBuiltYet:
except DependencyNotBuiltYet as exc:
index += 1
for _pkg_name in pkg_build.package_names:
deps_fails_counter.setdefault(_pkg_name, 0)
Expand All @@ -855,7 +855,7 @@ def build_packages(self) -> None: # pylint: disable=too-many-branches
print_error(
_("Dependency cycle detected between {}").format(deps_fails_counter)
)
raise SysExit(131)
raise SysExit(131) from exc
else:
print_debug(
f"Build done for packages {pkg_build.package_names=}, removing from queue"
Expand Down Expand Up @@ -948,10 +948,10 @@ def install_new_aur_deps(self) -> None:
deps_names_and_paths=new_aur_deps_to_install,
resolved_conflicts=self.resolved_conflicts
)
except DependencyError:
except DependencyError as exc:
if not ask_to_continue(default_yes=False):
self._revert_transaction(PackageSource.AUR)
raise SysExit(125)
raise SysExit(125) from exc
else:
self._save_transaction(
PackageSource.AUR, installed=list(new_aur_deps_to_install.keys())
Expand Down
2 changes: 1 addition & 1 deletion pikaur/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def cli_dynamic_select() -> None: # pragma: no cover
break
except NotANumberInput as exc:
if exc.character.lower() == _('n'):
raise SysExit(128)
raise SysExit(128) from exc
print_error(_('invalid number: {}').format(exc.character))

parse_args().positional = [packages[idx].name for idx in selected_pkgs_idx]
Expand Down
10 changes: 5 additions & 5 deletions pikaur/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def get_input(prompt: str, answers: Iterable[str] = (), require_confirm=False) -
TTYRestore.restore()
try:
answer = input(split_last_line(prompt)).lower()
except EOFError:
raise SysExit(125)
except EOFError as exc:
raise SysExit(125) from exc
finally:
sub_tty.restore_new()
if not answer:
Expand Down Expand Up @@ -126,16 +126,16 @@ def get_multiple_numbers_input(prompt: str, answers: Iterable[int] = ()) -> Iter
if '-' in block:
try:
range_start, range_end = [int(char) for char in block.split('-')]
except ValueError:
raise NotANumberInput(block)
except ValueError as exc:
raise NotANumberInput(block) from exc
if range_start > range_end:
raise NotANumberInput(block)
int_results += list(range(range_start, range_end + 1))
else:
try:
int_results.append(int(block))
except ValueError as exc:
raise NotANumberInput(exc.args[0].split("'")[-2])
raise NotANumberInput(exc.args[0].split("'")[-2]) from exc
return int_results


Expand Down
2 changes: 1 addition & 1 deletion pikaur/search_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def cli_search_packages(enumerated=False) -> List[AnyPackage]: # pylint: disabl
result_aur = request_aur.get() if request_aur else None
except AURError as exc:
print_stderr('AUR returned error: {}'.format(exc))
raise SysExit(121)
raise SysExit(121) from exc
pool.join()

if not args.quiet:
Expand Down
6 changes: 3 additions & 3 deletions pikaur/urllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def read_bytes_from_url(url: str, optional=False) -> bytes:
return b''
if ask_to_continue(_('Do you want to retry?')):
return read_bytes_from_url(url, optional=optional)
raise SysExit(102)
raise SysExit(102) from exc
result_bytes = response.read()
return result_bytes

Expand Down Expand Up @@ -66,10 +66,10 @@ def init_proxy() -> None:

try:
import socks # type: ignore[import] # pylint:disable=import-outside-toplevel
except ImportError:
except ImportError as exc:
raise ProxyInitSocks5Error(
_("pikaur requires python-pysocks to use a socks5 proxy.")
)
) from exc
socks.set_default_proxy(socks.PROXY_TYPE_SOCKS5, socks_proxy_addr, port)
socket.socket = socks.socksocket # type: ignore[misc]

Expand Down

0 comments on commit 4cd16ef

Please sign in to comment.