Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'pycodestyle' instead of 'pep8' #741

Merged
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
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ VERSION_TAG=$(PKGNAME)-$(VERSION)

ifeq ($(PYTHON),python3)
COVERAGE=coverage3
PEP8=$(PYTHON)-pep8
else
COVERAGE=coverage
PEP8=pep8
endif

ZANATA_PULL_ARGS = --transdir ./po/
Expand Down Expand Up @@ -62,7 +60,16 @@ pylint:

pep8:
@echo "*** Running pep8 compliance check ***"
$(PEP8) --ignore=E501,E402,E731 blivet/ tests/ examples/
@if test `which pycodestyle-3` ; then \
pep8='pycodestyle-3' ; \
elif test `which pycodestyle` ; then \
pep8='pycodestyle' ; \
elif test `which pep8` ; then \
pep8='pep8' ; \
else \
echo "You need to install pycodestyle/pep8 to run this check."; exit 1; \
fi ; \
$$pep8 --ignore=E501,E402,E731,W504 blivet/ tests/ examples/

canary: po-fallback
@echo "*** Running translation-canary tests ***"
Expand Down
1 change: 1 addition & 0 deletions blivet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def __dir__(self):
sys.modules["%s.%s" % (__package__, self._name)] = val
return dir(val)


# this way things like 'from blivet import Blivet' work without an overhead of
# importing of everything the Blivet class needs whenever anything from the
# 'blivet' package is imported (e.g. the 'arch' module)
Expand Down
2 changes: 2 additions & 0 deletions blivet/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def create_new_callbacks_register(create_format_pre=None,
resize_format_pre, resize_format_post,
wait_for_entropy, report_progress)


CreateFormatPreData = namedtuple("CreateFormatPreData",
["msg"])
CreateFormatPostData = namedtuple("CreateFormatPostData",
Expand Down Expand Up @@ -145,6 +146,7 @@ def __init__(self):
self.attribute_changed = CallbackList()
""" callback list for when a device or format attribute's value is changed"""


"""
.. data:: callbacks

Expand Down
1 change: 1 addition & 0 deletions blivet/devicelibs/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def _check_avail(self):

return lsm is not None


_lsm_required = _LSMDependencyGuard()


Expand Down
1 change: 1 addition & 0 deletions blivet/devicelibs/mdraid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def is_raid_level(cls, level):
hasattr(level, 'get_recommended_stride') and \
hasattr(level, 'get_size')


raid_levels = MDRaidLevels(["raid0", "raid1", "raid4", "raid5", "raid6", "raid10", "linear"])

EXTERNAL_DEPENDENCIES = [availability.BLOCKDEV_MDRAID_PLUGIN]
11 changes: 11 additions & 0 deletions blivet/devicelibs/raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def add_raid_level(self, level):
def __iter__(self):
return iter(self._raid_levels)


ALL_LEVELS = RAIDLevels()


Expand Down Expand Up @@ -428,6 +429,7 @@ class Striped(RAID0):
name = 'striped'
names = [name]


RAID0 = RAID0()
ALL_LEVELS.add_raid_level(RAID0)
Striped = Striped()
Expand Down Expand Up @@ -460,6 +462,7 @@ def _pad(self, size, chunk_size):
def _get_recommended_stride(self, member_count):
return None


RAID1 = RAID1()
ALL_LEVELS.add_raid_level(RAID1)

Expand Down Expand Up @@ -490,6 +493,7 @@ def _pad(self, size, chunk_size):
def _get_recommended_stride(self, member_count):
return (member_count - 1) * 16


RAID4 = RAID4()
ALL_LEVELS.add_raid_level(RAID4)

Expand Down Expand Up @@ -520,6 +524,7 @@ def _pad(self, size, chunk_size):
def _get_recommended_stride(self, member_count):
return (member_count - 1) * 16


RAID5 = RAID5()
ALL_LEVELS.add_raid_level(RAID5)

Expand Down Expand Up @@ -550,6 +555,7 @@ def _pad(self, size, chunk_size):
def _get_recommended_stride(self, member_count):
return None


RAID6 = RAID6()
ALL_LEVELS.add_raid_level(RAID6)

Expand Down Expand Up @@ -580,6 +586,7 @@ def _pad(self, size, chunk_size):
def _get_recommended_stride(self, member_count):
return None


RAID10 = RAID10()
ALL_LEVELS.add_raid_level(RAID10)

Expand Down Expand Up @@ -610,6 +617,7 @@ def get_size(self, member_sizes, num_members=None, chunk_size=None, superblock_s
# pylint: disable=unused-argument
return sum(member_sizes, Size(0))


Container = Container()
ALL_LEVELS.add_raid_level(Container)

Expand Down Expand Up @@ -662,6 +670,7 @@ class Linear(ErsatzRAID):
name = 'linear'
names = [name, 'jbod']


Linear = Linear()
ALL_LEVELS.add_raid_level(Linear)

Expand All @@ -672,6 +681,7 @@ class Single(ErsatzRAID):
name = 'single'
names = [name]


Single = Single()
ALL_LEVELS.add_raid_level(Single)

Expand All @@ -691,6 +701,7 @@ class Dup(RAIDLevel):
def has_redundancy(self):
return True


Dup = Dup()
ALL_LEVELS.add_raid_level(Dup)

Expand Down
8 changes: 4 additions & 4 deletions blivet/devices/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ def type(self):
@property
def ancestors(self):
""" A list of all of this device's ancestors, including itself. """
l = set([self])
for p in [d for d in self.parents if d not in l]:
l.update(set(p.ancestors))
return list(l)
ancestors = set([self])
for p in [d for d in self.parents if d not in ancestors]:
ancestors.update(set(p.ancestors))
return list(ancestors)

@property
def packages(self):
Expand Down
2 changes: 2 additions & 0 deletions blivet/devices/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def _collect_device_major_data():
except ValueError:
continue
return (by_major, by_device)


_devices_by_major, _majors_by_device = _collect_device_major_data()


Expand Down
1 change: 1 addition & 0 deletions blivet/devices/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self, pv, size):
self.pv = pv
self.size = size


PVFreeInfo = namedtuple("PVFreeInfo", ["pv", "size", "free"])
""" A namedtuple class holding the information about PV's (usable) size and free space """

Expand Down
1 change: 1 addition & 0 deletions blivet/fcoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def write_nic_fcoe_cfg(self, nic, dcb=True, auto_vlan=True, enable=True, mode=No
line = 'MODE="%s"\n' % mode
new_cfg.write(line)


# Create FCoE singleton
fcoe = FCoE()

Expand Down
2 changes: 2 additions & 0 deletions blivet/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def register_device_format(fmt_class):
log.debug("registered device format class %s as %s", fmt_class.__name__,
fmt_class._type)


default_fstypes = ("ext4", "xfs", "ext3", "ext2")


Expand Down Expand Up @@ -736,6 +737,7 @@ def populate_ksdata(self, data):
data.fstype = self.type
data.mountpoint = self.ks_mountpoint


register_device_format(DeviceFormat)

# import the format modules (which register their device formats)
Expand Down
1 change: 1 addition & 0 deletions blivet/formats/biosboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ def status(self):
def supported(self):
return super(BIOSBoot, self).supported and arch.is_x86() and not arch.is_efi()


register_device_format(BIOSBoot)
1 change: 1 addition & 0 deletions blivet/formats/disklabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,5 @@ def magic_partition_number(self):
else:
return 0


register_device_format(DiskLabel)
Loading