importer.py (7502:3ef7ff12c788) | importer.py (7801:f71f9634d809) |
---|---|
1# Copyright (c) 2008 The Hewlett-Packard Development Company 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 --- 21 unchanged lines hidden (view full) --- 30# code objects. The keys are the module path, and the items are the 31# filename and bytecode of the file. 32class CodeImporter(object): 33 def __init__(self): 34 self.modules = {} 35 36 def add_module(self, filename, abspath, modpath, code): 37 if modpath in self.modules: | 1# Copyright (c) 2008 The Hewlett-Packard Development Company 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 --- 21 unchanged lines hidden (view full) --- 30# code objects. The keys are the module path, and the items are the 31# filename and bytecode of the file. 32class CodeImporter(object): 33 def __init__(self): 34 self.modules = {} 35 36 def add_module(self, filename, abspath, modpath, code): 37 if modpath in self.modules: |
38 raise AttributeError, "%s already found in importer" | 38 raise AttributeError, "%s already found in importer" % modpath |
39 40 self.modules[modpath] = (filename, abspath, code) 41 42 def find_module(self, fullname, path): 43 if fullname in self.modules: 44 return self 45 46 return None --- 40 unchanged lines hidden --- | 39 40 self.modules[modpath] = (filename, abspath, code) 41 42 def find_module(self, fullname, path): 43 if fullname in self.modules: 44 return self 45 46 return None --- 40 unchanged lines hidden --- |