Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ all: check

check: check_version test yaml

style-check: pep8 $(pyflakes)
style-check: flake8

pep8:
@$(CWD)/tools/run-pep8

pyflakes:
@$(CWD)/tools/run-pyflakes
flake8:
@$(CWD)/tools/run-flake8

unittest: clean_pyc
python3 -m pytest -v tests/unittests cloudinit
Expand Down Expand Up @@ -86,6 +83,6 @@ deb-src:
doc:
tox -e doc

.PHONY: test pyflakes clean pep8 rpm srpm deb deb-src yaml
.PHONY: test flake8 clean rpm srpm deb deb-src yaml
.PHONY: check_version pip-test-requirements pip-requirements clean_pyc
.PHONY: unittest style-check doc
3 changes: 2 additions & 1 deletion cloudinit/cmd/devel/hotplug_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from cloudinit.net.network_state import parse_net_config_data
from cloudinit.reporting import events
from cloudinit.stages import Init
from cloudinit.sources import DataSource, DataSourceNotFoundException
from cloudinit.sources import DataSource # noqa: F401
from cloudinit.sources import DataSourceNotFoundException


LOG = log.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import string
import urllib.parse
from io import StringIO
from typing import Any, Mapping
from typing import Any, Mapping # noqa: F401

from cloudinit import importer
from cloudinit import log as logging
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import json
import os
from collections import namedtuple
from typing import Dict, List
from typing import Dict, List # noqa: F401

from cloudinit import dmi
from cloudinit import importer
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pickle
import sys
from collections import namedtuple
from typing import Dict, Set
from typing import Dict, Set # noqa: F401

from cloudinit.settings import (
FREQUENCIES, CLOUD_CONFIG, PER_INSTANCE, PER_ONCE, RUN_CLOUD_CONFIG)
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
RENDERED_TMPD_PREFIX = "RENDERED_TEMPD"
VARIANT = None


def is_f(p):
return os.path.isfile(p)


def is_generator(p):
return '-generator' in p

Expand Down Expand Up @@ -111,6 +113,7 @@ def render_tmpl(template, mode=None):
# return path relative to setup.py
return os.path.join(os.path.basename(tmpd), bname)


# User can set the variant for template rendering
if '--distro' in sys.argv:
idx = sys.argv.index('--distro')
Expand Down Expand Up @@ -166,7 +169,7 @@ def render_tmpl(template, mode=None):
with open('/etc/system-release-cpe') as f:
cpe_data = f.read().rstrip().split(':')

if cpe_data[1] == "\o":
if cpe_data[1] == "\o": # noqa: W605
# URI formated CPE
inc = 0
else:
Expand Down Expand Up @@ -216,7 +219,8 @@ def finalize_options(self):
if self.init_system and isinstance(self.init_system, str):
self.init_system = self.init_system.split(",")

if len(self.init_system) == 0 and not platform.system().endswith('BSD'):
if (len(self.init_system) == 0 and
not platform.system().endswith('BSD')):
self.init_system = ['systemd']

bad = [f for f in self.init_system if f not in INITSYS_TYPES]
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from tests.integration_tests.util import emit_dots_on_travis

try:
from typing import Optional
from typing import Optional # noqa: F401
except ImportError:
pass

Expand Down
4 changes: 3 additions & 1 deletion tests/integration_tests/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
try:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from tests.integration_tests.clouds import IntegrationCloud
from tests.integration_tests.clouds import ( # noqa: F401
Comment thread
sshedi marked this conversation as resolved.
IntegrationCloud
)
except ImportError:
pass

Expand Down
4 changes: 2 additions & 2 deletions tools/run-pyflakes → tools/run-flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CR="
"
pycheck_dirs=( "cloudinit/" "tests/" "tools/" )
pycheck_dirs=( "cloudinit/" "tests/" "tools/" "setup.py" )

set -f
if [ $# -eq 0 ]; then
Expand All @@ -11,7 +11,7 @@ else
files=( "$@" )
fi

cmd=( "python3" -m "pyflakes" "${files[@]}" )
cmd=( "python3" -m "flake8" "${files[@]}" )

echo "Running: " "${cmd[@]}" 1>&2
exec "${cmd[@]}"
21 changes: 0 additions & 21 deletions tools/run-pep8

This file was deleted.

4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ passenv=
basepython = python3
deps =
flake8==3.8.2
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ setup.py}

# https://github.com/gabrielfalcao/HTTPretty/issues/223
setenv =
Expand Down Expand Up @@ -119,7 +119,7 @@ deps =
pytest==3.0.7

[testenv:tip-flake8]
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ setup.py}
deps = flake8

[testenv:tip-pylint]
Expand Down