1
- // ==========================================================================
2
- // This software is subject to the provisions of the Zope Public License,
3
- // Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4
- // THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5
- // WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6
- // WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7
- // FOR A PARTICULAR PURPOSE.
8
- // ==========================================================================
9
1
10
2
using System ;
11
3
using System . IO ;
19
11
namespace Python . Runtime {
20
12
21
13
/// <summary>
22
- /// The AssemblyManager maintains information about loaded assemblies
14
+ /// The AssemblyManager maintains information about loaded assemblies
23
15
/// namespaces and provides an interface for name-based type lookup.
24
16
/// </summary>
25
17
@@ -42,7 +34,7 @@ private AssemblyManager() {}
42
34
//===================================================================
43
35
44
36
internal static void Initialize ( ) {
45
- namespaces = new
37
+ namespaces = new
46
38
Dictionary < string , Dictionary < Assembly , string > > ( 32 ) ;
47
39
probed = new Dictionary < string , int > ( 32 ) ;
48
40
//generics = new Dictionary<string, Dictionary<string, string>>();
@@ -54,7 +46,7 @@ internal static void Initialize() {
54
46
lhandler = new AssemblyLoadEventHandler ( AssemblyLoadHandler ) ;
55
47
domain . AssemblyLoad += lhandler ;
56
48
57
- rhandler = new ResolveEventHandler ( ResolveHandler ) ;
49
+ rhandler = new ResolveEventHandler ( ResolveHandler ) ;
58
50
domain . AssemblyResolve += rhandler ;
59
51
60
52
Assembly [ ] items = domain . GetAssemblies ( ) ;
@@ -85,10 +77,10 @@ internal static void Shutdown() {
85
77
86
78
87
79
//===================================================================
88
- // Event handler for assembly load events. At the time the Python
80
+ // Event handler for assembly load events. At the time the Python
89
81
// runtime loads, we scan the app domain to map the assemblies that
90
82
// are loaded at the time. We also have to register this event handler
91
- // so that we can know about assemblies that get loaded after the
83
+ // so that we can know about assemblies that get loaded after the
92
84
// Python runtime is initialized.
93
85
//===================================================================
94
86
@@ -122,11 +114,11 @@ static Assembly ResolveHandler(Object ob, ResolveEventArgs args){
122
114
123
115
//===================================================================
124
116
// We __really__ want to avoid using Python objects or APIs when
125
- // probing for assemblies to load, since our ResolveHandler may be
117
+ // probing for assemblies to load, since our ResolveHandler may be
126
118
// called in contexts where we don't have the Python GIL and can't
127
119
// even safely try to get it without risking a deadlock ;(
128
120
//
129
- // To work around that, we update a managed copy of sys.path (which
121
+ // To work around that, we update a managed copy of sys.path (which
130
122
// is the main thing we care about) when UpdatePath is called. The
131
123
// import hook calls this whenever it knows its about to use the
132
124
// assembly manager, which lets us keep up with changes to sys.path
@@ -216,11 +208,11 @@ public static Assembly LoadAssemblyPath(string name) {
216
208
return assembly ;
217
209
}
218
210
219
- /// <summary>
220
- /// Loads an assembly using full path.
221
- /// </summary>
222
- /// <param name="name"></param>
223
- /// <returns></returns>
211
+ /// <summary>
212
+ /// Loads an assembly using full path.
213
+ /// </summary>
214
+ /// <param name="name"></param>
215
+ /// <returns></returns>
224
216
public static Assembly LoadAssemblyFullPath ( string name ) {
225
217
Assembly assembly = null ;
226
218
if ( Path . IsPathRooted ( name ) ) {
@@ -249,7 +241,7 @@ public static Assembly FindLoadedAssembly(string name) {
249
241
}
250
242
251
243
//===================================================================
252
- // Given a qualified name of the form A.B.C.D, attempt to load
244
+ // Given a qualified name of the form A.B.C.D, attempt to load
253
245
// an assembly named after each of A.B.C.D, A.B.C, A.B, A. This
254
246
// will only actually probe for the assembly once for each unique
255
247
// namespace. Returns true if any assemblies were loaded.
@@ -304,7 +296,7 @@ public static bool LoadImplicit(string name, bool warn=true) {
304
296
//===================================================================
305
297
// Scans an assembly for exported namespaces, adding them to the
306
298
// mapping of valid namespaces. Note that for a given namespace
307
- // a.b.c.d, each of a, a.b, a.b.c and a.b.c.d are considered to
299
+ // a.b.c.d, each of a, a.b, a.b.c and a.b.c.d are considered to
308
300
// be valid namespaces (to better match Python import semantics).
309
301
//===================================================================
310
302
@@ -402,7 +394,7 @@ public static List<string> GetNames(string nsname) {
402
394
//string tail = key.Substring(nslen);
403
395
if ( key . IndexOf ( '.' ) == - 1 ) {
404
396
names . Add ( key ) ;
405
- }
397
+ }
406
398
}
407
399
}
408
400
}
0 commit comments