Changeset 284
- Timestamp:
- 01/16/06 20:18:36 (3 years ago)
- Files:
-
- pycrash/trunk/crash/component.py (modified) (1 diff)
- pycrash/trunk/crash/console.py (modified) (1 diff)
- pycrash/trunk/crash/decorators.py (modified) (1 diff)
- pycrash/trunk/crash/__init__.py (modified) (1 diff)
- pycrash/trunk/crash/network.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pycrash/trunk/crash/component.py
r282 r284 225 225 return dict((c.__name__, c) for c in ComponentMeta._components \ 226 226 if hasattr(c, '_implements') and interface in c._implements) 227 228 def get_component_definition(self, name, interface = None): 229 """ Get a component class by name. Does not instantiate the component. """ 230 if interface is not None: 231 try: 232 return get_implementors(interface)[name] 233 except KeyError: 234 raise ComponentError, 'No component named %s implementing %s.' % (name, interface.__name__) 235 for c in ComponentMeta._components: 236 if c.__name__ == name: 237 return c 238 raise ComponentError, 'No component named %s.' % name 239 240 def get_component(self, name, interface = None): 241 """ Get a component instance by name. """ 242 return self[self.get_component_definition(name, interface)] 243 244 def get_selected_implementation(self, interface): 245 """ Get the singleton implementation of interface. Should return the 246 name of the component to use. """ 247 raise NotImplementedError pycrash/trunk/crash/console.py
r282 r284 179 179 return out.rstrip() 180 180 181 def print_table( table, header = None, sep = ' ', auto_format = ['^B^U', '^6', '^B^6'], expand_to_fit = 1):181 def print_table(header, table, sep = ' ', auto_format = ['^B^U', '^6', '^B^6'], expand_to_fit = 1): 182 182 """Print a list of lists as a table, so that columns line up nicely. 183 183 header, if specified, will be printed as the first row. sep is the pycrash/trunk/crash/decorators.py
r282 r284 1 1 import inspect, re, types 2 3 __all__ = [ 'validate', 'abstract', 'default_members' ] 2 4 3 5 class validate: pycrash/trunk/crash/__init__.py
r268 r284 1 import classmaker, component, console, decorators, loader, network, \ 2 singleton, threadpool, util pycrash/trunk/crash/network.py
r279 r284 14 14 15 15 For the purposes of this class, an "int" representation of a network is 16 the 32-bit raw integer form (eg. 4294967168L), "cidr" is the number of bits in a 17 netmask (eg. 26) and dq is the full dotted-quad form (eg. 10.2.3.4). 16 the 32-bit raw integer form (eg. 4294967168L), "cidr" is the number of 17 bits in a netmask (eg. 26) and dq is the full dotted-quad form (eg. 18 10.2.3.4). 18 19 """ 19 20
