//=================================================================== // Preloads all currently-known names for the module namespace. This // can be called multiple times, to add names from assemblies that // may have been loaded since the last call to the method. //=================================================================== public void LoadNames() { ManagedType m = null; foreach (string name in AssemblyManager.GetNames(_namespace)) { this.cache.TryGetValue(name, out m); if (m == null) { ManagedType attr = this.GetAttribute(name, true); if (Runtime.wrap_exceptions) { if (attr is ExceptionClassObject) { ExceptionClassObject c = attr as ExceptionClassObject; if (c != null) { IntPtr p = attr.pyHandle; IntPtr r = Exceptions.GetExceptionClassWrapper(p); Runtime.PyDict_SetItemString(dict, name, r); Runtime.Incref(r); } } } } } }
/// <summary> /// Preloads all currently-known names for the module namespace. This /// can be called multiple times, to add names from assemblies that /// may have been loaded since the last call to the method. /// </summary> public void LoadNames() { foreach (var name in AssemblyManager.GetNames(_namespace)) { var attr = GetAttribute(name, true); } }
/// <summary> /// Preloads all currently-known names for the module namespace. This /// can be called multiple times, to add names from assemblies that /// may have been loaded since the last call to the method. /// </summary> public void LoadNames() { ManagedType m = null; foreach (string name in AssemblyManager.GetNames(_namespace)) { cache.TryGetValue(name, out m); if (m == null) { ManagedType attr = GetAttribute(name, true); } } }
/// <summary> /// Preloads all currently-known names for the module namespace. This /// can be called multiple times, to add names from assemblies that /// may have been loaded since the last call to the method. /// </summary> public void LoadNames() { ManagedType m = null; foreach (string name in AssemblyManager.GetNames(_namespace)) { cache.TryGetValue(name, out m); if (m != null) { continue; } IntPtr attr = Runtime.PyDict_GetItemString(dict, name); // If __dict__ has already set a custom property, skip it. if (attr != IntPtr.Zero) { continue; } GetAttribute(name, true); } }
/// <summary> /// Preloads all currently-known names for the module namespace. This /// can be called multiple times, to add names from assemblies that /// may have been loaded since the last call to the method. /// </summary> public void LoadNames() { ManagedType m = null; foreach (string name in AssemblyManager.GetNames(_namespace)) { cache.TryGetValue(name, out m); if (m != null) { continue; } BorrowedReference attr = Runtime.PyDict_GetItemString(DictRef, name); // If __dict__ has already set a custom property, skip it. if (!attr.IsNull) { continue; } GetAttribute(name, true); } }
//=================================================================== // Preloads all currently-known names for the module namespace. This // can be called multiple times, to add names from assemblies that // may have been loaded since the last call to the method. //=================================================================== public void LoadNames() { foreach (string name in AssemblyManager.GetNames(_namespace)) { if (!this.cache.ContainsKey(name)) { ManagedType attr = this.GetAttribute(name); if (Runtime.wrap_exceptions) { if (attr is ClassBase) { ClassBase c = attr as ClassBase; if (c.is_exception) { IntPtr p = attr.pyHandle; IntPtr r = Exceptions.GetExceptionClassWrapper(p); Runtime.PyDict_SetItemString(dict, name, r); Runtime.Incref(r); } } } } } }
/// <summary> /// Preloads all currently-known names for the module namespace. This /// can be called multiple times, to add names from assemblies that /// may have been loaded since the last call to the method. /// </summary> public void LoadNames() { ManagedType m = null; foreach (string name in AssemblyManager.GetNames(_namespace)) { cache.TryGetValue(name, out m); if (m != null) { continue; } BorrowedReference attr = Runtime.PyDict_GetItemString(DictRef, name); // If __dict__ has already set a custom property, skip it. if (!attr.IsNull) { continue; } if (GetAttribute(name, true) != null) { // if it's a valid attribute, add it to __all__ var pyname = Runtime.PyString_FromString(name); try { if (Runtime.PyList_Append(new BorrowedReference(__all__), new BorrowedReference(pyname)) != 0) { throw PythonException.ThrowLastAsClrException(); } } finally { Runtime.XDecref(pyname); } } } }