Skip to content

Commit

Permalink
Fix CI - pylint
Browse files Browse the repository at this point in the history
Github pylint check will return
    make: [Makefile:50: pylint] Error 127 (ignored)
and pylint check has been skipped because in Makefile $(PYLINT) is an
empty string

Fix the Makefile and everything pylint compaints

Disable unspecified-encoding (when open()) because Windows is not our
target platform
  • Loading branch information
orange-kao committed Nov 3, 2021
1 parent eac6e9b commit 6cfb8d1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ disable=
line-too-long,
no-else-continue,
no-else-break,
import-outside-toplevel
import-outside-toplevel,
unspecified-encoding

[FORMAT]
max-line-length=125
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ all:
PYTHON ?= python3
PYTHON_SOURCE_DIRS = rpm_s3_mirror/ tests/
PYTEST_ARG ?= -v
PYLINT=$(shell which pylint 2> /dev/null | which pylint-3)
PYLINT=$(shell which pylint 2> /dev/null || which pylint-3)

clean:
$(RM) -r *.egg-info/ build/ dist/ rpm/
Expand Down
2 changes: 1 addition & 1 deletion rpm_s3_mirror/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _sync_repository(self, upstream_repository):
upstream_metadata = upstream_repository.parse_metadata()

mirror_repository = RPMRepository(base_url=self._build_s3_url(upstream_repository.base_url))
bootstrap = False if mirror_repository.exists() else True
bootstrap = not mirror_repository.exists()
if bootstrap:
self.log.info("Bootstrapping repository: %s", upstream_repository.base_url)
new_packages = upstream_metadata.package_list
Expand Down
2 changes: 1 addition & 1 deletion rpm_s3_mirror/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def parse_repomd(self, xml: Element) -> Dict[str, RepodataSection]:
return sections

def _req(self, method, path, *, json=None, params=None, acceptible_status_code=None, **kwargs) -> Response:
acceptible_status_code = acceptible_status_code if acceptible_status_code else {200}
acceptible_status_code = acceptible_status_code or {200}
url = f"{self.base_url}{path}"
response = method(url, json=json, params=params, **kwargs)
if response.status_code not in acceptible_status_code:
Expand Down
2 changes: 1 addition & 1 deletion rpm_s3_mirror/statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ def _send(self, metric, metric_type, value, tags):
parts.append(pattern.format(separator, tag, val).encode("utf-8"))
else:
for tag, val in send_tags.items():
parts.insert(1, ",{}={}".format(tag, val).encode("utf-8"))
parts.insert(1, f",{tag}={val}".encode("utf-8"))

self._socket.sendto(b"".join(parts), self._dest_addr)

0 comments on commit 6cfb8d1

Please sign in to comment.