Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Jun 7, 2022
1 parent be621d1 commit 470b348
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions whey_conda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# this package
from whey_conda.config import WheyCondaParser

__all__ = ["CondaBuilder"]
__all__ = ("CondaBuilder", )

__author__: str = "Dominic Davis-Foster"
__copyright__: str = "2020-2021 Dominic Davis-Foster"
Expand Down Expand Up @@ -187,6 +187,7 @@ def write_conda_about(self) -> None:

about = {}

# pylint: disable=loop-invariant-statement
for category, url in self.config["urls"].items():
if category.lower() in {"homepage", "home page"}:
about["home"] = url
Expand All @@ -212,6 +213,7 @@ def write_conda_about(self) -> None:
author = []
maintainer = []

# pylint: disable=use-list-comprehension
for entry in self.config["authors"]:
if entry["name"]:
author.append(entry["name"])
Expand All @@ -225,6 +227,8 @@ def write_conda_about(self) -> None:
elif author:
about["extra"] = {"maintainers": author}

# pylint: enable=loop-invariant-statement,use-list-comprehension

about_json_file = self.info_dir / "about.json"
about_json_file.dump_json(about, indent=2)
self.report_written(about_json_file)
Expand Down Expand Up @@ -275,7 +279,7 @@ def create_conda_archive(self, wheel_contents_dir: PathLike, build_number: int =
# Ensure the digest and size are updated for "conda" rather than "pip"
if ".dist-info/INSTALLER,sha256=" in line:
record_lines[idx] = get_record_entry(
dist_info_dir / "INSTALLER",
dist_info_dir / "INSTALLER", # pylint: disable=loop-invariant-statement
relative_to=wheel_contents_dir,
)
elif ".dist-info/direct_url.json,sha256=" in line:
Expand All @@ -286,7 +290,7 @@ def create_conda_archive(self, wheel_contents_dir: PathLike, build_number: int =
# Remove double blank line caused by removal of entries
file.write_clean('\n'.join(record_lines).replace("\n\n", '\n'))

elif file.name in {"REQUESTED", "direct_url.json"}:
elif file.name in {"REQUESTED", "direct_url.json"}: # pylint: disable=loop-invariant-statement
continue

if file.is_file():
Expand Down Expand Up @@ -385,6 +389,7 @@ def build_conda(self) -> str:


def pip_install_wheel(wheel_file: PathLike, target_dir: PathLike, verbose: bool = False) -> None:
# pylint: disable=use-tuple-over-list
command = [
"pip",
"install",
Expand All @@ -397,6 +402,7 @@ def pip_install_wheel(wheel_file: PathLike, target_dir: PathLike, verbose: bool
"--no-warn-conflicts",
"--disable-pip-version-check",
]
# pylint: enable=use-tuple-over-list

process = Popen(command, stdout=PIPE)
(output, err) = process.communicate()
Expand Down
4 changes: 2 additions & 2 deletions whey_conda/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from dom_toml.parser import TOML_TYPES, AbstractConfigParser, BadConfigError, construct_path
from typing_extensions import Literal

__all__ = ["WheyCondaParser"]
__all__ = ("WheyCondaParser", )


class WheyCondaParser(AbstractConfigParser):
Expand Down Expand Up @@ -124,7 +124,7 @@ def parse_conda_extras(

extras = config["conda-extras"]

path_elements = [*self.table_name, "conda-extras"]
path_elements = [*self.table_name, "conda-extras"] # pylint: disable=use-tuple-over-list

if isinstance(extras, str):
extras_lower = extras.lower()
Expand Down

0 comments on commit 470b348

Please sign in to comment.