code_formatter.py (6651:9f6b8815d045) | code_formatter.py (6999:f226c098c393) |
---|---|
1# Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org> 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 41 unchanged lines hidden (view full) --- 50 return self.kwargs[item] 51 52 if item == '__file__': 53 return self.frame.f_code.co_filename 54 55 if item == '__line__': 56 return self.frame.f_lineno 57 | 1# Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org> 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 41 unchanged lines hidden (view full) --- 50 return self.kwargs[item] 51 52 if item == '__file__': 53 return self.frame.f_code.co_filename 54 55 if item == '__line__': 56 return self.frame.f_lineno 57 |
58 if self.formatter.locals and item in self.frame.f_locals: 59 return self.frame.f_locals[item] 60 |
|
58 if item in self.dict: 59 return self.dict[item] 60 | 61 if item in self.dict: 62 return self.dict[item] 63 |
61 if self.formatter.locals or self.formatter.globals: 62 if self.formatter.locals and item in self.frame.f_locals: 63 return self.frame.f_locals[item] | 64 if self.formatter.globals and item in self.frame.f_globals: 65 return self.frame.f_globals[item] |
64 | 66 |
65 if self.formatter.globals and item in self.frame.f_globals: 66 return self.frame.f_globals[item] 67 | |
68 if item in __builtin__.__dict__: 69 return __builtin__.__dict__[item] 70 71 try: 72 item = int(item) 73 return self.args[item] 74 except ValueError: 75 pass --- 43 unchanged lines hidden (view full) --- 119 globals = True 120 locals = True 121 fix_newlines = True 122 def __init__(self, *args, **kwargs): 123 self._data = [] 124 self._dict = {} 125 self._indent_level = 0 126 self._indent_spaces = 4 | 67 if item in __builtin__.__dict__: 68 return __builtin__.__dict__[item] 69 70 try: 71 item = int(item) 72 return self.args[item] 73 except ValueError: 74 pass --- 43 unchanged lines hidden (view full) --- 118 globals = True 119 locals = True 120 fix_newlines = True 121 def __init__(self, *args, **kwargs): 122 self._data = [] 123 self._dict = {} 124 self._indent_level = 0 125 self._indent_spaces = 4 |
127 self.globals = kwargs.pop('globals',type(self).globals) | 126 self.globals = kwargs.pop('globals', type(self).globals) |
128 self.locals = kwargs.pop('locals', type(self).locals) 129 self._fix_newlines = \ 130 kwargs.pop('fix_newlines', type(self).fix_newlines) 131 132 if args: 133 self.__call__(args) 134 135 def indent(self): --- 177 unchanged lines hidden --- | 127 self.locals = kwargs.pop('locals', type(self).locals) 128 self._fix_newlines = \ 129 kwargs.pop('fix_newlines', type(self).fix_newlines) 130 131 if args: 132 self.__call__(args) 133 134 def indent(self): --- 177 unchanged lines hidden --- |