__init__.py (8453:82fc1267d3bb) __init__.py (9528:d05714c2ab9c)
1# Copyright (c) 2008-2009 The Hewlett-Packard Development Company
2# Copyright (c) 2004-2006 The Regents of The University of Michigan
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 42 unchanged lines hidden (view full) ---

51
52# fatal() should be called when the simulation cannot continue due to
53# some condition that is the user's fault (bad configuration, invalid
54# arguments, etc.) and not a simulator bug.
55def fatal(fmt, *args):
56 print >>sys.stderr, 'fatal:', fmt % args
57 sys.exit(1)
58
1# Copyright (c) 2008-2009 The Hewlett-Packard Development Company
2# Copyright (c) 2004-2006 The Regents of The University of Michigan
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 42 unchanged lines hidden (view full) ---

51
52# fatal() should be called when the simulation cannot continue due to
53# some condition that is the user's fault (bad configuration, invalid
54# arguments, etc.) and not a simulator bug.
55def fatal(fmt, *args):
56 print >>sys.stderr, 'fatal:', fmt % args
57 sys.exit(1)
58
59# warn() should be called when the user should be warned about some condition
60# that may or may not be the user's fault, but that they should be made aware
61# of as it may affect the simulation or results.
62def warn(fmt, *args):
63 print >>sys.stderr, 'warn:', fmt % args
64
65# inform() should be called when the user should be informed about some
66# condition that they may be interested in.
67def inform(fmt, *args):
68 print >>sys.stdout, 'info:', fmt % args
69
59class Singleton(type):
60 def __call__(cls, *args, **kwargs):
61 if hasattr(cls, '_instance'):
62 return cls._instance
63
64 cls._instance = super(Singleton, cls).__call__(*args, **kwargs)
65 return cls._instance
66

--- 121 unchanged lines hidden ---
70class Singleton(type):
71 def __call__(cls, *args, **kwargs):
72 if hasattr(cls, '_instance'):
73 return cls._instance
74
75 cls._instance = super(Singleton, cls).__call__(*args, **kwargs)
76 return cls._instance
77

--- 121 unchanged lines hidden ---