1 From ea7a3ac6c658164690e0febb55f4467cb9e0bcac Mon Sep 17 00:00:00 2001
2 From: Thomas Klausner <wiz@NetBSD.org>
3 Date: Thu, 19 May 2016 17:30:04 +0200
4 Subject: [PATCH] Make whitespace use consistent.
6 At least python-3.5.x complains about this forcefully.
8 Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
9 Signed-off-by: Uli Schlachter <psychon@znc.in>
10 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
12 xcbgen/align.py | 96 ++++++++++++++++++++++++++++-----------------------------
13 1 file changed, 48 insertions(+), 48 deletions(-)
15 diff --git a/xcbgen/align.py b/xcbgen/align.py
16 index 5e31838..d4c12ee 100644
19 @@ -16,12 +16,12 @@ class Alignment(object):
20 return self.align == other.align and self.offset == other.offset
23 - return "(align=%d, offset=%d)" % (self.align, self.offset)
24 + return "(align=%d, offset=%d)" % (self.align, self.offset)
27 def for_primitive_type(size):
28 - # compute the required start_alignment based on the size of the type
30 + # compute the required start_alignment based on the size of the type
32 # do 8-byte primitives require 8-byte alignment in X11?
35 @@ -33,7 +33,7 @@ class Alignment(object):
38 def align_after_fixed_size(self, size):
39 - new_offset = (self.offset + size) % self.align
40 + new_offset = (self.offset + size) % self.align
41 return Alignment(self.align, new_offset)
44 @@ -41,7 +41,7 @@ class Alignment(object):
46 Assuming the given external_align, checks whether
47 self is fulfilled for all cases.
48 - Returns True if yes, False otherwise.
49 + Returns True if yes, False otherwise.
51 if self.align == 1 and self.offset == 0:
52 # alignment 1 with offset 0 is always fulfilled
53 @@ -55,9 +55,9 @@ class Alignment(object):
54 # the external align guarantees less alignment -> not guaranteed
57 - if external_align.align % self.align != 0:
58 + if external_align.align % self.align != 0:
59 # the external align cannot be divided by our align
62 # (this can only happen if there are alignments that are not
63 # a power of 2, which is highly discouraged. But better be
64 # safe and check for it)
65 @@ -72,7 +72,7 @@ class Alignment(object):
67 def combine_with(self, other):
68 # returns the alignment that is guaranteed when
69 - # both, self or other, can happen
70 + # both, self or other, can happen
71 new_align = gcd(self.align, other.align)
72 new_offset_candidate1 = self.offset % new_align
73 new_offset_candidate2 = other.offset % new_align
74 @@ -83,8 +83,8 @@ class Alignment(object):
75 new_align = gcd(new_align, offset_diff)
76 new_offset_candidate1 = self.offset % new_align
77 new_offset_candidate2 = other.offset % new_align
78 - assert new_offset_candidate1 == new_offset_candidate2
79 - new_offset = new_offset_candidate1
80 + assert new_offset_candidate1 == new_offset_candidate2
81 + new_offset = new_offset_candidate1
83 return Alignment(new_align, new_offset)
85 @@ -92,44 +92,44 @@ class Alignment(object):
86 class AlignmentLog(object):
100 - # output the OK-list
101 - for (align_before, field_name, type_obj, callstack, align_after) in self.ok_list:
102 - stacksize = len(callstack)
103 + # output the OK-list
104 + for (align_before, field_name, type_obj, callstack, align_after) in self.ok_list:
105 + stacksize = len(callstack)
106 indent = ' ' * stacksize
107 - if self.ok_callstack_is_relevant(callstack):
108 + if self.ok_callstack_is_relevant(callstack):
109 if field_name is None or field_name == "":
110 - result += (" %sok: %s:\n\t%sbefore: %s, after: %s\n"
111 - % (indent, str(type_obj), indent, str(align_before), str(align_after)))
113 - result += (" %sok: field \"%s\" in %s:\n\t%sbefore: %s, after: %s\n"
114 - % (indent, str(field_name), str(type_obj),
115 - indent, str(align_before), str(align_after)))
116 + result += (" %sok: %s:\n\t%sbefore: %s, after: %s\n"
117 + % (indent, str(type_obj), indent, str(align_before), str(align_after)))
119 + result += (" %sok: field \"%s\" in %s:\n\t%sbefore: %s, after: %s\n"
120 + % (indent, str(field_name), str(type_obj),
121 + indent, str(align_before), str(align_after)))
122 if self.verbosity >= 1:
123 - result += self.callstack_to_str(indent, callstack)
124 + result += self.callstack_to_str(indent, callstack)
126 - # output the fail-list
127 - for (align_before, field_name, type_obj, callstack, reason) in self.fail_list:
128 - stacksize = len(callstack)
129 + # output the fail-list
130 + for (align_before, field_name, type_obj, callstack, reason) in self.fail_list:
131 + stacksize = len(callstack)
132 indent = ' ' * stacksize
133 - if field_name is None or field_name == "":
134 - result += (" %sfail: align %s is incompatible with\n\t%s%s\n\t%sReason: %s\n"
135 - % (indent, str(align_before), indent, str(type_obj), indent, reason))
137 - result += (" %sfail: align %s is incompatible with\n\t%sfield \"%s\" in %s\n\t%sReason: %s\n"
138 - % (indent, str(align_before), indent, str(field_name), str(type_obj), indent, reason))
139 + if field_name is None or field_name == "":
140 + result += (" %sfail: align %s is incompatible with\n\t%s%s\n\t%sReason: %s\n"
141 + % (indent, str(align_before), indent, str(type_obj), indent, reason))
143 + result += (" %sfail: align %s is incompatible with\n\t%sfield \"%s\" in %s\n\t%sReason: %s\n"
144 + % (indent, str(align_before), indent, str(field_name), str(type_obj), indent, reason))
146 if self.verbosity >= 1:
147 - result += self.callstack_to_str(indent, callstack)
148 + result += self.callstack_to_str(indent, callstack)
155 def callstack_to_str(self, indent, callstack):
156 @@ -137,41 +137,41 @@ class AlignmentLog(object):
157 for stack_elem in callstack:
158 result += "\t %s%s\n" % (indent, str(stack_elem))
159 result += "\t%s]\n" % indent
164 def ok_callstack_is_relevant(self, ok_callstack):
165 # determine whether an ok callstack is relevant for logging
166 - if self.verbosity >= 2:
168 + if self.verbosity >= 2:
171 # empty callstacks are always relevant
172 - if len(ok_callstack) == 0:
173 + if len(ok_callstack) == 0:
176 - # check whether the ok_callstack is a subset or equal to a fail_callstack
177 + # check whether the ok_callstack is a subset or equal to a fail_callstack
178 for (align_before, field_name, type_obj, fail_callstack, reason) in self.fail_list:
179 if len(ok_callstack) <= len(fail_callstack):
180 zipped = zip(ok_callstack, fail_callstack[:len(ok_callstack)])
181 - is_subset = all([i == j for i, j in zipped])
183 + is_subset = all([i == j for i, j in zipped])
190 def ok(self, align_before, field_name, type_obj, callstack, align_after):
191 - self.ok_list.append((align_before, field_name, type_obj, callstack, align_after))
192 + self.ok_list.append((align_before, field_name, type_obj, callstack, align_after))
194 def fail(self, align_before, field_name, type_obj, callstack, reason):
195 - self.fail_list.append((align_before, field_name, type_obj, callstack, reason))
196 + self.fail_list.append((align_before, field_name, type_obj, callstack, reason))
198 def append(self, other):
199 - self.ok_list.extend(other.ok_list)
200 - self.fail_list.extend(other.fail_list)
201 + self.ok_list.extend(other.ok_list)
202 + self.fail_list.extend(other.fail_list)
205 - return len(self.ok_list)
206 + return len(self.ok_list)