Show More
@@ -88,9 +88,8 b' def fromlocalfunc(modulename, localmods)' | |||||
88 | `modulename` is an `dotted_name_of_path()`-ed source file path, |
|
88 | `modulename` is an `dotted_name_of_path()`-ed source file path, | |
89 | which may have `.__init__` at the end of it, of the target source. |
|
89 | which may have `.__init__` at the end of it, of the target source. | |
90 |
|
90 | |||
91 | `localmods` is a dict (or set), of which key is an absolute |
|
91 | `localmods` is a set of absolute `dotted_name_of_path()`-ed source file | |
92 | `dotted_name_of_path()`-ed source file path of locally defined (= |
|
92 | paths of locally defined (= Mercurial specific) modules. | |
93 | Mercurial specific) modules. |
|
|||
94 |
|
93 | |||
95 | This function assumes that module names not existing in |
|
94 | This function assumes that module names not existing in | |
96 | `localmods` are from the Python standard library. |
|
95 | `localmods` are from the Python standard library. | |
@@ -114,9 +113,9 b' def fromlocalfunc(modulename, localmods)' | |||||
114 | convenient, even though this is also equivalent to "absname != |
|
113 | convenient, even though this is also equivalent to "absname != | |
115 | dottednpath") |
|
114 | dottednpath") | |
116 |
|
115 | |||
117 |
>>> localmods = {'foo.__init__' |
|
116 | >>> localmods = {'foo.__init__', 'foo.foo1', | |
118 |
... 'foo.bar.__init__' |
|
117 | ... 'foo.bar.__init__', 'foo.bar.bar1', | |
119 |
... 'baz.__init__' |
|
118 | ... 'baz.__init__', 'baz.baz1'} | |
120 | >>> fromlocal = fromlocalfunc('foo.xxx', localmods) |
|
119 | >>> fromlocal = fromlocalfunc('foo.xxx', localmods) | |
121 | >>> # relative |
|
120 | >>> # relative | |
122 | >>> fromlocal('foo1') |
|
121 | >>> fromlocal('foo1') | |
@@ -257,7 +256,7 b' def imported_modules(source, modulename,' | |||||
257 | Args: |
|
256 | Args: | |
258 | source: The python source to examine as a string. |
|
257 | source: The python source to examine as a string. | |
259 | modulename: of specified python source (may have `__init__`) |
|
258 | modulename: of specified python source (may have `__init__`) | |
260 |
localmods: |
|
259 | localmods: set of locally defined module names (may have `__init__`) | |
261 | ignore_nested: If true, import statements that do not start in |
|
260 | ignore_nested: If true, import statements that do not start in | |
262 | column zero will be ignored. |
|
261 | column zero will be ignored. | |
263 |
|
262 | |||
@@ -696,13 +695,14 b' def main(argv):' | |||||
696 | if argv[1] == '-': |
|
695 | if argv[1] == '-': | |
697 | argv = argv[:1] |
|
696 | argv = argv[:1] | |
698 | argv.extend(l.rstrip() for l in sys.stdin.readlines()) |
|
697 | argv.extend(l.rstrip() for l in sys.stdin.readlines()) | |
699 | localmods = {} |
|
698 | localmodpaths = {} | |
700 | used_imports = {} |
|
699 | used_imports = {} | |
701 | any_errors = False |
|
700 | any_errors = False | |
702 | for source_path in argv[1:]: |
|
701 | for source_path in argv[1:]: | |
703 | modname = dotted_name_of_path(source_path) |
|
702 | modname = dotted_name_of_path(source_path) | |
704 | localmods[modname] = source_path |
|
703 | localmodpaths[modname] = source_path | |
705 | for localmodname, source_path in sorted(localmods.items()): |
|
704 | localmods = set(localmodpaths) | |
|
705 | for localmodname, source_path in sorted(localmodpaths.items()): | |||
706 | for src, modname, name, line in sources(source_path, localmodname): |
|
706 | for src, modname, name, line in sources(source_path, localmodname): | |
707 | try: |
|
707 | try: | |
708 | used_imports[modname] = sorted( |
|
708 | used_imports[modname] = sorted( |
General Comments 0
You need to be logged in to leave comments.
Login now