From 232dcb995e656f211d43a0eb37ce50e997ba50e5 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Thu, 9 Jul 2015 05:34:02 -0700 Subject: [PATCH] Whitespace cleanup --- elftools/common/construct_utils.py | 9 ++++----- elftools/dwarf/abbrevtable.py | 15 +++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/elftools/common/construct_utils.py b/elftools/common/construct_utils.py index 53caa97..8ace30e 100644 --- a/elftools/common/construct_utils.py +++ b/elftools/common/construct_utils.py @@ -10,11 +10,11 @@ from ..construct import Subconstruct, ConstructError, ArrayError class RepeatUntilExcluding(Subconstruct): - """ A version of construct's RepeatUntil that doesn't include the last + """ A version of construct's RepeatUntil that doesn't include the last element (which casued the repeat to exit) in the return value. - + Only parsing is currently implemented. - + P.S. removed some code duplication """ __slots__ = ["predicate"] @@ -29,7 +29,7 @@ class RepeatUntilExcluding(Subconstruct): context_for_subcon = context if self.subcon.conflags & self.FLAG_COPY_CONTEXT: context_for_subcon = context.__copy__() - + while True: subobj = self.subcon._parse(stream, context_for_subcon) if self.predicate(subobj, context): @@ -42,4 +42,3 @@ class RepeatUntilExcluding(Subconstruct): raise NotImplementedError('no building') def _sizeof(self, context): raise SizeofError("can't calculate size") - diff --git a/elftools/dwarf/abbrevtable.py b/elftools/dwarf/abbrevtable.py index 44ccdd5..36f6d2a 100644 --- a/elftools/dwarf/abbrevtable.py +++ b/elftools/dwarf/abbrevtable.py @@ -15,10 +15,10 @@ class AbbrevTable(object): def __init__(self, structs, stream, offset): """ Create new abbreviation table. Parses the actual table from the stream and stores it internally. - + structs: A DWARFStructs instance for parsing the data - + stream, offset: The stream and offset into the stream where this abbreviation table lives. @@ -26,7 +26,7 @@ class AbbrevTable(object): self.structs = structs self.stream = stream self.offset = offset - + self._abbrev_map = self._parse_abbrev_table() def get_abbrev(self, code): @@ -54,15 +54,15 @@ class AbbrevTable(object): class AbbrevDecl(object): - """ Wraps a parsed abbreviation declaration, exposing its fields with + """ Wraps a parsed abbreviation declaration, exposing its fields with dict-like access, and adding some convenience methods. - + The abbreviation declaration represents an "entry" that points to it. """ def __init__(self, code, decl): self.code = code self.decl = decl - + def has_children(self): """ Does the entry have children? """ @@ -74,7 +74,6 @@ class AbbrevDecl(object): """ for attr_spec in self['attr_spec']: yield attr_spec.name, attr_spec.form - + def __getitem__(self, entry): return self.decl[entry] - -- 2.30.2