Skip to content

Commit

Permalink
tox: bump pylint to 2.12.2
Browse files Browse the repository at this point in the history
This solves a E1136 false positive with Python 3.9 [1], but the code
needs some changes to test clean.

[1] pylint-dev/pylint#3882
  • Loading branch information
paride committed Dec 13, 2021
1 parent 7af2be9 commit b019d77
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs=4
# C0122: misplaced-comparison-constant
# C0301: line-too-long (flake8 already catches this for us)
# R0201: Method could be a function (no-self-use)
disable=R0902, R0903, R0913, W0221, C0103, C0122, C0301, R0201
# C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
# R0801: Similar lines in 2 files
disable=R0902, R0903, R0913, W0221, C0103, C0122, C0301, R0201, C0209, R0801

[TYPECHECK]
# Ignore the googleapiclient module to avoid no-member checks
Expand Down
4 changes: 2 additions & 2 deletions examples/az.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def demo():
pub_path = "pub_test.pem"
priv_path = "priv_test.pem"

with open(pub_path, "w") as f:
with open(pub_path, "w", encoding="utf-8") as f:
f.write(pub_key)

with open(priv_path, "w") as f:
with open(priv_path, "w", encoding="utf-8") as f:
f.write(priv_key)
client.use_key(pub_path, priv_path)

Expand Down
4 changes: 2 additions & 2 deletions examples/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def demo():
priv_key_path = "gce-privkey"
pub_key, priv_key = gce.create_key_pair()

with open(pub_key_path, "w") as f:
with open(pub_key_path, "w", encoding="utf-8") as f:
f.write(pub_key)

with open(priv_key_path, "w") as f:
with open(priv_key_path, "w", encoding="utf-8") as f:
f.write(priv_key)

os.chmod(pub_key_path, 0o600)
Expand Down
4 changes: 2 additions & 2 deletions examples/lxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ def launch_virtual_machine():
priv_key_path = "lxd-privkey"
pub_key, priv_key = lxd.create_key_pair()

with open(pub_key_path, "w") as f:
with open(pub_key_path, "w", encoding="utf-8") as f:
f.write(pub_key)

with open(priv_key_path, "w") as f:
with open(priv_key_path, "w", encoding="utf-8") as f:
f.write(priv_key)

lxd.use_key(
Expand Down
2 changes: 1 addition & 1 deletion pycloudlib/azure/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from azure.mgmt.network import NetworkManagementClient
from azure.mgmt.compute import ComputeManagementClient

import pycloudlib.azure.util as util
from pycloudlib.azure import util
from pycloudlib.cloud import BaseCloud
from pycloudlib.azure.instance import AzureInstance
from pycloudlib.config import ConfigFile
Expand Down
5 changes: 3 additions & 2 deletions pycloudlib/instance.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is part of pycloudlib. See LICENSE file for license information.
"""Base class for all instances to provide consistent set of functions."""

from abc import ABC, abstractmethod, abstractproperty
from abc import ABC, abstractmethod
import logging
import time

Expand Down Expand Up @@ -43,7 +43,8 @@ def name(self):
"""Return instance name."""
raise NotImplementedError

@abstractproperty
@property
@abstractmethod
def ip(self):
"""Return IP address of instance."""
raise NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion pycloudlib/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def public_key_content(self):
output of public key
"""
return open(self.public_key_path).read()
return open(self.public_key_path, encoding="utf-8").read()
4 changes: 2 additions & 2 deletions pycloudlib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ def subp(args, data=None, env=None, shell=False, rcs=(0,),
elif shortcircuit_stdin:
# using devnull assures any reads get null, rather
# than possibly waiting on input.
devnull_fp = open(os.devnull)
devnull_fp = open(os.devnull, "rb") # pylint: disable=R1732
stdin = devnull_fp
else:
stdin = None

bytes_args = _convert_args(args)

try:
process = subprocess.Popen(
process = subprocess.Popen( # pylint: disable=R1732
bytes_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=stdin, env=env, shell=shell
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read_readme():
"""Read and return text of README.md."""
pwd = os.path.abspath(os.path.dirname(__name__))
readme_file = os.path.join(pwd, 'README.md')
with open(readme_file, 'r') as readme:
with open(readme_file, 'r', encoding='utf-8') as readme:
readme_txt = readme.read()

return readme_txt
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ envdir = {toxworkdir}/.testenv
deps =
flake8==4.0.1
flake8-docstrings==1.6.0
pylint==2.6.2
pylint==2.12.2
-rrequirements.txt
-rtest-requirements.txt

Expand Down

0 comments on commit b019d77

Please sign in to comment.