| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | using System; | |
| 2 | 2 | using System.Collections.Generic; | |
| 3 | + using System.IO; | ||
| 3 | 4 | using System.Reflection; | |
| 4 | 5 | using Python.Runtime; | |
| 5 | 6 | ||
@@ -40,7 +41,7 @@ public static int Main(string[] args) | |||
| 40 | 41 | // (Python.Runtime.dll is included as a resource) | |
| 41 | 42 | private sealed class AssemblyLoader | |
| 42 | 43 | { | |
| 43 | - Dictionary<string, Assembly> loadedAssemblies; | ||
| 44 | + private Dictionary<string, Assembly> loadedAssemblies; | ||
| 44 | 45 | ||
| 45 | 46 | public AssemblyLoader() | |
| 46 | 47 | { | |
@@ -57,7 +58,7 @@ public AssemblyLoader() | |||
| 57 | 58 | } | |
| 58 | 59 | ||
| 59 | 60 | // looks for the assembly from the resources and load it | |
| 60 | - using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) | ||
| 61 | + using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) | ||
| 61 | 62 | { | |
| 62 | 63 | if (stream != null) | |
| 63 | 64 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ public void TearDown() | |||
| 27 | 27 | public void TestToInt64() | |
| 28 | 28 | { | |
| 29 | 29 | long largeNumber = 8L * 1024L * 1024L * 1024L; // 8 GB | |
| 30 | - PyLong pyLargeNumber = new PyLong(largeNumber); | ||
| 30 | + var pyLargeNumber = new PyLong(largeNumber); | ||
| 31 | 31 | Assert.AreEqual(largeNumber, pyLargeNumber.ToInt64()); | |
| 32 | 32 | } | |
| 33 | 33 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,16 +17,16 @@ internal class AssemblyManager | |||
| 17 | 17 | { | |
| 18 | 18 | // modified from event handlers below, potentially triggered from different .NET threads | |
| 19 | 19 | // therefore this should be a ConcurrentDictionary | |
| 20 | - static ConcurrentDictionary<string, ConcurrentDictionary<Assembly, string>> namespaces; | ||
| 21 | - //static Dictionary<string, Dictionary<string, string>> generics; | ||
| 22 | - static AssemblyLoadEventHandler lhandler; | ||
| 23 | - static ResolveEventHandler rhandler; | ||
| 20 | + private static ConcurrentDictionary<string, ConcurrentDictionary<Assembly, string>> namespaces; | ||
| 21 | + //private static Dictionary<string, Dictionary<string, string>> generics; | ||
| 22 | + private static AssemblyLoadEventHandler lhandler; | ||
| 23 | + private static ResolveEventHandler rhandler; | ||
| 24 | 24 | ||
| 25 | 25 | // updated only under GIL? | |
| 26 | - static Dictionary<string, int> probed; | ||
| 26 | + private static Dictionary<string, int> probed; | ||
| 27 | 27 | ||
| 28 | 28 | // modified from event handlers below, potentially triggered from different .NET threads | |
| 29 | - static AssemblyList assemblies; | ||
| 29 | + private static AssemblyList assemblies; | ||
| 30 | 30 | internal static List<string> pypath; | |
| 31 | 31 | ||
| 32 | 32 | private AssemblyManager() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,8 +17,8 @@ namespace Python.Runtime | |||
| 17 | 17 | /// </summary> | |
| 18 | 18 | internal class ClassManager | |
| 19 | 19 | { | |
| 20 | - static Dictionary<Type, ClassBase> cache; | ||
| 21 | - static Type dtype; | ||
| 20 | + private static Dictionary<Type, ClassBase> cache; | ||
| 21 | + private static Type dtype; | ||
| 22 | 22 | ||
| 23 | 23 | private ClassManager() | |
| 24 | 24 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,8 +13,8 @@ namespace Python.Runtime | |||
| 13 | 13 | /// </summary> | |
| 14 | 14 | internal class CodeGenerator | |
| 15 | 15 | { | |
| 16 | - AssemblyBuilder aBuilder; | ||
| 17 | - ModuleBuilder mBuilder; | ||
| 16 | + private AssemblyBuilder aBuilder; | ||
| 17 | + private ModuleBuilder mBuilder; | ||
| 18 | 18 | ||
| 19 | 19 | internal CodeGenerator() | |
| 20 | 20 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,10 +21,10 @@ namespace Python.Runtime | |||
| 21 | 21 | /// </remarks> | |
| 22 | 22 | internal class ConstructorBinding : ExtensionType | |
| 23 | 23 | { | |
| 24 | - Type type; // The managed Type being wrapped in a ClassObject | ||
| 25 | - IntPtr pyTypeHndl; // The python type tells GetInstHandle which Type to create. | ||
| 26 | - ConstructorBinder ctorBinder; | ||
| 27 | - IntPtr repr; | ||
| 24 | + private Type type; // The managed Type being wrapped in a ClassObject | ||
| 25 | + private IntPtr pyTypeHndl; // The python type tells GetInstHandle which Type to create. | ||
| 26 | + private ConstructorBinder ctorBinder; | ||
| 27 | + private IntPtr repr; | ||
| 28 | 28 | ||
| 29 | 29 | public ConstructorBinding(Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder) | |
| 30 | 30 | { | |
@@ -165,11 +165,11 @@ public static IntPtr tp_repr(IntPtr ob) | |||
| 165 | 165 | /// </remarks> | |
| 166 | 166 | internal class BoundContructor : ExtensionType | |
| 167 | 167 | { | |
| 168 | - Type type; // The managed Type being wrapped in a ClassObject | ||
| 169 | - IntPtr pyTypeHndl; // The python type tells GetInstHandle which Type to create. | ||
| 170 | - ConstructorBinder ctorBinder; | ||
| 171 | - ConstructorInfo ctorInfo; | ||
| 172 | - IntPtr repr; | ||
| 168 | + private Type type; // The managed Type being wrapped in a ClassObject | ||
| 169 | + private IntPtr pyTypeHndl; // The python type tells GetInstHandle which Type to create. | ||
| 170 | + private ConstructorBinder ctorBinder; | ||
| 171 | + private ConstructorInfo ctorInfo; | ||
| 172 | + private IntPtr repr; | ||
| 173 | 173 | ||
| 174 | 174 | public BoundContructor(Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder, ConstructorInfo ci) | |
| 175 | 175 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,18 +17,18 @@ private Converter() | |||
| 17 | 17 | { | |
| 18 | 18 | } | |
| 19 | 19 | ||
| 20 | - static NumberFormatInfo nfi; | ||
| 21 | - static Type objectType; | ||
| 22 | - static Type stringType; | ||
| 23 | - static Type singleType; | ||
| 24 | - static Type doubleType; | ||
| 25 | - static Type decimalType; | ||
| 26 | - static Type int16Type; | ||
| 27 | - static Type int32Type; | ||
| 28 | - static Type int64Type; | ||
| 29 | - static Type flagsType; | ||
| 30 | - static Type boolType; | ||
| 31 | - static Type typeType; | ||
| 20 | + private static NumberFormatInfo nfi; | ||
| 21 | + private static Type objectType; | ||
| 22 | + private static Type stringType; | ||
| 23 | + private static Type singleType; | ||
| 24 | + private static Type doubleType; | ||
| 25 | + private static Type decimalType; | ||
| 26 | + private static Type int16Type; | ||
| 27 | + private static Type int32Type; | ||
| 28 | + private static Type int64Type; | ||
| 29 | + private static Type flagsType; | ||
| 30 | + private static Type boolType; | ||
| 31 | + private static Type typeType; | ||
| 32 | 32 | ||
| 33 | 33 | static Converter() | |
| 34 | 34 | { | |
@@ -415,7 +415,7 @@ internal static bool ToManagedValue(IntPtr value, Type obType, | |||
| 415 | 415 | /// <summary> | |
| 416 | 416 | /// Convert a Python value to an instance of a primitive managed type. | |
| 417 | 417 | /// </summary> | |
| 418 | - static bool ToPrimitive(IntPtr value, Type obType, out Object result, bool setError) | ||
| 418 | + private static bool ToPrimitive(IntPtr value, Type obType, out object result, bool setError) | ||
| 419 | 419 | { | |
| 420 | 420 | IntPtr overflow = Exceptions.OverflowError; | |
| 421 | 421 | TypeCode tc = Type.GetTypeCode(obType); | |
@@ -826,7 +826,7 @@ static void SetConversionError(IntPtr value, Type target) | |||
| 826 | 826 | /// The Python value must support the Python sequence protocol and the | |
| 827 | 827 | /// items in the sequence must be convertible to the target array type. | |
| 828 | 828 | /// </summary> | |
| 829 | - static bool ToArray(IntPtr value, Type obType, out Object result, bool setError) | ||
| 829 | + private static bool ToArray(IntPtr value, Type obType, out object result, bool setError) | ||
| 830 | 830 | { | |
| 831 | 831 | Type elementType = obType.GetElementType(); | |
| 832 | 832 | int size = Runtime.PySequence_Size(value); | |
@@ -875,7 +875,7 @@ static bool ToArray(IntPtr value, Type obType, out Object result, bool setError) | |||
| 875 | 875 | /// <summary> | |
| 876 | 876 | /// Convert a Python value to a correctly typed managed enum instance. | |
| 877 | 877 | /// </summary> | |
| 878 | - static bool ToEnum(IntPtr value, Type obType, out Object result, bool setError) | ||
| 878 | + private static bool ToEnum(IntPtr value, Type obType, out object result, bool setError) | ||
| 879 | 879 | { | |
| 880 | 880 | Type etype = Enum.GetUnderlyingType(obType); | |
| 881 | 881 | result = null; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,13 @@ namespace Python.Runtime | |||
| 11 | 11 | /// </summary> | |
| 12 | 12 | internal class DelegateManager | |
| 13 | 13 | { | |
| 14 | - Hashtable cache; | ||
| 15 | - Type basetype; | ||
| 16 | - Type listtype; | ||
| 17 | - Type voidtype; | ||
| 18 | - Type typetype; | ||
| 19 | - Type ptrtype; | ||
| 20 | - CodeGenerator codeGenerator; | ||
| 14 | + private Hashtable cache; | ||
| 15 | + private Type basetype; | ||
| 16 | + private Type listtype; | ||
| 17 | + private Type voidtype; | ||
| 18 | + private Type typetype; | ||
| 19 | + private Type ptrtype; | ||
| 20 | + private CodeGenerator codeGenerator; | ||
| 21 | 21 | ||
| 22 | 22 | public DelegateManager() | |
| 23 | 23 | { | |
@@ -180,6 +180,7 @@ A possible alternate strategy would be to create custom subclasses | |||
| 180 | 180 | This would be slightly cleaner, but I'm not sure if delegates are | |
| 181 | 181 | too "special" for this to work. It would be more work, so for now | |
| 182 | 182 | the 80/20 rule applies :) */ | |
| 183 | + | ||
| 183 | 184 | public class Dispatcher | |
| 184 | 185 | { | |
| 185 | 186 | public IntPtr target; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ namespace Python.Runtime | |||
| 10 | 10 | /// </summary> | |
| 11 | 11 | internal class DelegateObject : ClassBase | |
| 12 | 12 | { | |
| 13 | - MethodBinder binder; | ||
| 13 | + private MethodBinder binder; | ||
| 14 | 14 | ||
| 15 | 15 | internal DelegateObject(Type tp) : base(tp) | |
| 16 | 16 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,8 +7,8 @@ namespace Python.Runtime | |||
| 7 | 7 | /// </summary> | |
| 8 | 8 | internal class EventBinding : ExtensionType | |
| 9 | 9 | { | |
| 10 | - EventObject e; | ||
| 11 | - IntPtr target; | ||
| 10 | + private EventObject e; | ||
| 11 | + private IntPtr target; | ||
| 12 | 12 | ||
| 13 | 13 | public EventBinding(EventObject e, IntPtr target) | |
| 14 | 14 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments