Skip to content

Commit 717d250

Browse files
committed
tox: bump pylint to 2.12.2
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
1 parent 7af2be9 commit 717d250

File tree

10 files changed

+18
-15
lines changed

10 files changed

+18
-15
lines changed

.pylintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs=4
1111
# C0122: misplaced-comparison-constant
1212
# C0301: line-too-long (flake8 already catches this for us)
1313
# R0201: Method could be a function (no-self-use)
14-
disable=R0902, R0903, R0913, W0221, C0103, C0122, C0301, R0201
14+
# C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
15+
# R0801: Similar lines in 2 files
16+
disable=R0902, R0903, R0913, W0221, C0103, C0122, C0301, R0201, C0209, R0801
1517

1618
[TYPECHECK]
1719
# Ignore the googleapiclient module to avoid no-member checks

examples/az.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def demo():
3131
pub_path = "pub_test.pem"
3232
priv_path = "priv_test.pem"
3333

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

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

examples/gce.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def demo():
2727
priv_key_path = "gce-privkey"
2828
pub_key, priv_key = gce.create_key_pair()
2929

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

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

3636
os.chmod(pub_key_path, 0o600)

examples/lxd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ def launch_virtual_machine():
210210
priv_key_path = "lxd-privkey"
211211
pub_key, priv_key = lxd.create_key_pair()
212212

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

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

219219
lxd.use_key(

pycloudlib/azure/cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from azure.mgmt.network import NetworkManagementClient
77
from azure.mgmt.compute import ComputeManagementClient
88

9-
import pycloudlib.azure.util as util
9+
from pycloudlib.azure import util
1010
from pycloudlib.cloud import BaseCloud
1111
from pycloudlib.azure.instance import AzureInstance
1212
from pycloudlib.config import ConfigFile

pycloudlib/instance.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is part of pycloudlib. See LICENSE file for license information.
22
"""Base class for all instances to provide consistent set of functions."""
33

4-
from abc import ABC, abstractmethod, abstractproperty
4+
from abc import ABC, abstractmethod
55
import logging
66
import time
77

@@ -43,7 +43,8 @@ def name(self):
4343
"""Return instance name."""
4444
raise NotImplementedError
4545

46-
@abstractproperty
46+
@property
47+
@abstractmethod
4748
def ip(self):
4849
"""Return IP address of instance."""
4950
raise NotImplementedError

pycloudlib/key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ def public_key_content(self):
3838
output of public key
3939
4040
"""
41-
return open(self.public_key_path).read()
41+
return open(self.public_key_path, encoding="utf-8").read()

pycloudlib/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ def subp(args, data=None, env=None, shell=False, rcs=(0,),
169169
elif shortcircuit_stdin:
170170
# using devnull assures any reads get null, rather
171171
# than possibly waiting on input.
172-
devnull_fp = open(os.devnull)
172+
devnull_fp = open(os.devnull, "rb") # pylint: disable=R1732
173173
stdin = devnull_fp
174174
else:
175175
stdin = None
176176

177177
bytes_args = _convert_args(args)
178178

179179
try:
180-
process = subprocess.Popen(
180+
process = subprocess.Popen( # pylint: disable=R1732
181181
bytes_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
182182
stdin=stdin, env=env, shell=shell
183183
)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def read_readme():
88
"""Read and return text of README.md."""
99
pwd = os.path.abspath(os.path.dirname(__name__))
1010
readme_file = os.path.join(pwd, 'README.md')
11-
with open(readme_file, 'r') as readme:
11+
with open(readme_file, 'r', encoding='utf-8') as readme:
1212
readme_txt = readme.read()
1313

1414
return readme_txt

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ envdir = {toxworkdir}/.testenv
77
deps =
88
flake8==4.0.1
99
flake8-docstrings==1.6.0
10-
pylint==2.6.2
10+
pylint==2.12.2
1111
-rrequirements.txt
1212
-rtest-requirements.txt
1313

0 commit comments

Comments
 (0)