*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
diff --git a/lldb/examples/summaries/cocoa/attrib_fromdict.py b/lldb/examples/summaries/cocoa/attrib_fromdict.py
index 86964d6..39abe6b 100644
--- a/lldb/examples/summaries/cocoa/attrib_fromdict.py
+++ b/lldb/examples/summaries/cocoa/attrib_fromdict.py
@@ -5,34 +5,38 @@
This file is distributed under the University of Illinois Open Source
License. See LICENSE.TXT for details.
"""
+
+
class AttributesDictionary:
- def __init__(self, allow_reset = True):
- self.__dict__['_dictionary'] = {} # need to do it this way to prevent endless recursion
- self.__dict__['_allow_reset'] = allow_reset
- def __getattr__(self,name):
- if not self._check_exists(name):
- return None
- value = self._dictionary[name]
- return value
+ def __init__(self, allow_reset=True):
+ # need to do it this way to prevent endless recursion
+ self.__dict__['_dictionary'] = {}
+ self.__dict__['_allow_reset'] = allow_reset
- def _set_impl(self,name,value):
- self._dictionary[name] = value
+ def __getattr__(self, name):
+ if not self._check_exists(name):
+ return None
+ value = self._dictionary[name]
+ return value
- def _check_exists(self,name):
- return name in self._dictionary
+ def _set_impl(self, name, value):
+ self._dictionary[name] = value
- def __setattr__(self,name,value):
- if self._allow_reset:
- self._set_impl(name,value)
- else:
- self.set_if_necessary(name,value)
+ def _check_exists(self, name):
+ return name in self._dictionary
- def set_if_necessary(self,name,value):
- if not self._check_exists(name):
- self._set_impl(name,value)
- return True
- return False
+ def __setattr__(self, name, value):
+ if self._allow_reset:
+ self._set_impl(name, value)
+ else:
+ self.set_if_necessary(name, value)
- def __len__(self):
- return len(self._dictionary)
\ No newline at end of file
+ def set_if_necessary(self, name, value):
+ if not self._check_exists(name):
+ self._set_impl(name, value)
+ return True
+ return False
+
+ def __len__(self):
+ return len(self._dictionary)