| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,8 +10,7 @@ | |||
| 10 | 10 | [assembly: AssemblyDefaultAlias("python.exe")] | |
| 11 | 11 | [assembly: CLSCompliant(true)] | |
| 12 | 12 | [assembly: ComVisible(false)] | |
| 13 | - [assembly: PermissionSet(SecurityAction.RequestMinimum, | ||
| 14 | - Name = "FullTrust")] | ||
| 13 | + [assembly: PermissionSet(SecurityAction.RequestMinimum, Name = "FullTrust")] | ||
| 15 | 14 | [assembly: AssemblyDescription("")] | |
| 16 | 15 | [assembly: AssemblyCopyright("MIT License")] | |
| 17 | 16 | [assembly: AssemblyFileVersion("2.0.0.4")] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,9 +80,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) | |||
| 80 | 80 | } | |
| 81 | 81 | catch (IndexOutOfRangeException) | |
| 82 | 82 | { | |
| 83 | - Exceptions.SetError(Exceptions.IndexError, | ||
| 84 | - "array index out of range" | ||
| 85 | - ); | ||
| 83 | + Exceptions.SetError(Exceptions.IndexError, "array index out of range"); | ||
| 86 | 84 | return IntPtr.Zero; | |
| 87 | 85 | } | |
| 88 | 86 | ||
@@ -93,9 +91,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) | |||
| 93 | 91 | ||
| 94 | 92 | if (!Runtime.PyTuple_Check(idx)) | |
| 95 | 93 | { | |
| 96 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 97 | - "invalid index value" | ||
| 98 | - ); | ||
| 94 | + Exceptions.SetError(Exceptions.TypeError, "invalid index value"); | ||
| 99 | 95 | return IntPtr.Zero; | |
| 100 | 96 | } | |
| 101 | 97 | ||
@@ -127,9 +123,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) | |||
| 127 | 123 | } | |
| 128 | 124 | catch (IndexOutOfRangeException) | |
| 129 | 125 | { | |
| 130 | - Exceptions.SetError(Exceptions.IndexError, | ||
| 131 | - "array index out of range" | ||
| 132 | - ); | ||
| 126 | + Exceptions.SetError(Exceptions.IndexError, "array index out of range"); | ||
| 133 | 127 | return IntPtr.Zero; | |
| 134 | 128 | } | |
| 135 | 129 | ||
@@ -182,9 +176,7 @@ public static int mp_ass_subscript(IntPtr ob, IntPtr idx, IntPtr v) | |||
| 182 | 176 | } | |
| 183 | 177 | catch (IndexOutOfRangeException) | |
| 184 | 178 | { | |
| 185 | - Exceptions.SetError(Exceptions.IndexError, | ||
| 186 | - "array index out of range" | ||
| 187 | - ); | ||
| 179 | + Exceptions.SetError(Exceptions.IndexError, "array index out of range"); | ||
| 188 | 180 | return -1; | |
| 189 | 181 | } | |
| 190 | 182 | ||
@@ -226,9 +218,7 @@ public static int mp_ass_subscript(IntPtr ob, IntPtr idx, IntPtr v) | |||
| 226 | 218 | } | |
| 227 | 219 | catch (IndexOutOfRangeException) | |
| 228 | 220 | { | |
| 229 | - Exceptions.SetError(Exceptions.IndexError, | ||
| 230 | - "array index out of range" | ||
| 231 | - ); | ||
| 221 | + Exceptions.SetError(Exceptions.IndexError, "array index out of range"); | ||
| 232 | 222 | return -1; | |
| 233 | 223 | } | |
| 234 | 224 | ||
@@ -272,4 +262,4 @@ public static int mp_length(IntPtr ob) | |||
| 272 | 262 | return items.Length; | |
| 273 | 263 | } | |
| 274 | 264 | } | |
| 275 | - } | ||
| 265 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,8 +39,7 @@ private AssemblyManager() | |||
| 39 | 39 | ||
| 40 | 40 | internal static void Initialize() | |
| 41 | 41 | { | |
| 42 | - namespaces = new | ||
| 43 | - ConcurrentDictionary<string, ConcurrentDictionary<Assembly, string>>(); | ||
| 42 | + namespaces = new ConcurrentDictionary<string, ConcurrentDictionary<Assembly, string>>(); | ||
| 44 | 43 | probed = new Dictionary<string, int>(32); | |
| 45 | 44 | //generics = new Dictionary<string, Dictionary<string, string>>(); | |
| 46 | 45 | assemblies = new AssemblyList(16); | |
@@ -206,9 +205,10 @@ public static Assembly LoadAssembly(string name) | |||
| 206 | 205 | { | |
| 207 | 206 | assembly = Assembly.Load(name); | |
| 208 | 207 | } | |
| 209 | - catch (System.Exception e) | ||
| 208 | + catch (System.Exception) | ||
| 210 | 209 | { | |
| 211 | - //if (!(e is System.IO.FileNotFoundException)) { | ||
| 210 | + //if (!(e is System.IO.FileNotFoundException)) | ||
| 211 | + //{ | ||
| 212 | 212 | // throw; | |
| 213 | 213 | //} | |
| 214 | 214 | } | |
@@ -480,13 +480,15 @@ public static Type LookupType(string qname) | |||
| 480 | 480 | } | |
| 481 | 481 | ||
| 482 | 482 | /// <summary> | |
| 483 | - /// Wrapper around List<Assembly> for thread safe access | ||
| 483 | + /// Wrapper around List<Assembly> for thread safe access | ||
| 484 | 484 | /// </summary> | |
| 485 | - private class AssemblyList : IEnumerable<Assembly>{ | ||
| 485 | + private class AssemblyList : IEnumerable<Assembly> | ||
| 486 | + { | ||
| 486 | 487 | private readonly List<Assembly> _list; | |
| 487 | 488 | private readonly ReaderWriterLockSlim _lock; | |
| 488 | 489 | ||
| 489 | - public AssemblyList(int capacity) { | ||
| 490 | + public AssemblyList(int capacity) | ||
| 491 | + { | ||
| 490 | 492 | _list = new List<Assembly>(capacity); | |
| 491 | 493 | _lock = new ReaderWriterLockSlim(); | |
| 492 | 494 | } | |
@@ -496,16 +498,19 @@ public int Count | |||
| 496 | 498 | get | |
| 497 | 499 | { | |
| 498 | 500 | _lock.EnterReadLock(); | |
| 499 | - try { | ||
| 501 | + try | ||
| 502 | + { | ||
| 500 | 503 | return _list.Count; | |
| 501 | 504 | } | |
| 502 | - finally { | ||
| 505 | + finally | ||
| 506 | + { | ||
| 503 | 507 | _lock.ExitReadLock(); | |
| 504 | 508 | } | |
| 505 | 509 | } | |
| 506 | 510 | } | |
| 507 | 511 | ||
| 508 | - public void Add(Assembly assembly) { | ||
| 512 | + public void Add(Assembly assembly) | ||
| 513 | + { | ||
| 509 | 514 | _lock.EnterWriteLock(); | |
| 510 | 515 | try | |
| 511 | 516 | { | |
@@ -519,7 +524,7 @@ public void Add(Assembly assembly) { | |||
| 519 | 524 | ||
| 520 | 525 | public IEnumerator GetEnumerator() | |
| 521 | 526 | { | |
| 522 | - return ((IEnumerable<Assembly>) this).GetEnumerator(); | ||
| 527 | + return ((IEnumerable<Assembly>)this).GetEnumerator(); | ||
| 523 | 528 | } | |
| 524 | 529 | ||
| 525 | 530 | /// <summary> | |
@@ -555,9 +560,15 @@ public void Reset() | |||
| 555 | 560 | _listEnumerator.Reset(); | |
| 556 | 561 | } | |
| 557 | 562 | ||
| 558 | - public Assembly Current { get { return _listEnumerator.Current; } } | ||
| 563 | + public Assembly Current | ||
| 564 | + { | ||
| 565 | + get { return _listEnumerator.Current; } | ||
| 566 | + } | ||
| 559 | 567 | ||
| 560 | - object IEnumerator.Current { get { return Current; } } | ||
| 568 | + object IEnumerator.Current | ||
| 569 | + { | ||
| 570 | + get { return Current; } | ||
| 571 | + } | ||
| 561 | 572 | } | |
| 562 | 573 | ||
| 563 | 574 | IEnumerator<Assembly> IEnumerable<Assembly>.GetEnumerator() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,8 @@ public virtual IntPtr type_subscript(IntPtr idx) | |||
| 68 | 68 | // Standard comparison implementation for instances of reflected types. | |
| 69 | 69 | //==================================================================== | |
| 70 | 70 | ||
| 71 | - public static IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) { | ||
| 71 | + public static IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) | ||
| 72 | + { | ||
| 72 | 73 | CLRObject co1; | |
| 73 | 74 | CLRObject co2; | |
| 74 | 75 | switch (op) | |
@@ -116,7 +117,7 @@ public static IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) { | |||
| 116 | 117 | case Runtime.Py_GE: | |
| 117 | 118 | co1 = GetManagedObject(ob) as CLRObject; | |
| 118 | 119 | co2 = GetManagedObject(other) as CLRObject; | |
| 119 | - if(co1 == null || co2 == null) | ||
| 120 | + if (co1 == null || co2 == null) | ||
| 120 | 121 | return Exceptions.RaiseTypeError("Cannot get managed object"); | |
| 121 | 122 | var co1Comp = co1.inst as IComparable; | |
| 122 | 123 | if (co1Comp == null) | |
@@ -150,10 +151,12 @@ public static IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) { | |||
| 150 | 151 | } | |
| 151 | 152 | else | |
| 152 | 153 | { | |
| 153 | - if (op == Runtime.Py_GE || op == Runtime.Py_GT) { | ||
| 154 | + if (op == Runtime.Py_GE || op == Runtime.Py_GT) | ||
| 155 | + { | ||
| 154 | 156 | pyCmp = Runtime.PyTrue; | |
| 155 | 157 | } | |
| 156 | - else { | ||
| 158 | + else | ||
| 159 | + { | ||
| 157 | 160 | pyCmp = Runtime.PyFalse; | |
| 158 | 161 | } | |
| 159 | 162 | } | |
@@ -285,4 +288,4 @@ public static void tp_dealloc(IntPtr ob) | |||
| 285 | 288 | self.gcHandle.Free(); | |
| 286 | 289 | } | |
| 287 | 290 | } | |
| 288 | - } | ||
| 291 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,8 +33,7 @@ static ClassDerivedObject() | |||
| 33 | 33 | moduleBuilders = new Dictionary<Tuple<string, string>, ModuleBuilder>(); | |
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | - internal ClassDerivedObject(Type tp) | ||
| 37 | - : base(tp) | ||
| 36 | + internal ClassDerivedObject(Type tp): base(tp) | ||
| 38 | 37 | { | |
| 39 | 38 | } | |
| 40 | 39 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -397,4 +397,4 @@ internal ClassInfo(Type t) | |||
| 397 | 397 | public Hashtable members; | |
| 398 | 398 | public Indexer indexer; | |
| 399 | 399 | } | |
| 400 | - } | ||
| 400 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,9 +71,7 @@ public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw) | |||
| 71 | 71 | { | |
| 72 | 72 | if (Runtime.PyTuple_Size(args) != 1) | |
| 73 | 73 | { | |
| 74 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 75 | - "no constructors match given arguments" | ||
| 76 | - ); | ||
| 74 | + Exceptions.SetError(Exceptions.TypeError, "no constructors match given arguments"); | ||
| 77 | 75 | return IntPtr.Zero; | |
| 78 | 76 | } | |
| 79 | 77 | ||
@@ -90,17 +88,13 @@ public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw) | |||
| 90 | 88 | ||
| 91 | 89 | if (type.IsAbstract) | |
| 92 | 90 | { | |
| 93 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 94 | - "cannot instantiate abstract class" | ||
| 95 | - ); | ||
| 91 | + Exceptions.SetError(Exceptions.TypeError, "cannot instantiate abstract class"); | ||
| 96 | 92 | return IntPtr.Zero; | |
| 97 | 93 | } | |
| 98 | 94 | ||
| 99 | 95 | if (type.IsEnum) | |
| 100 | 96 | { | |
| 101 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 102 | - "cannot instantiate enumeration" | ||
| 103 | - ); | ||
| 97 | + Exceptions.SetError(Exceptions.TypeError, "cannot instantiate enumeration"); | ||
| 104 | 98 | return IntPtr.Zero; | |
| 105 | 99 | } | |
| 106 | 100 | ||
@@ -178,9 +172,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) | |||
| 178 | 172 | ||
| 179 | 173 | if (cls.indexer == null || !cls.indexer.CanGet) | |
| 180 | 174 | { | |
| 181 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 182 | - "unindexable object" | ||
| 183 | - ); | ||
| 175 | + Exceptions.SetError(Exceptions.TypeError, "unindexable object"); | ||
| 184 | 176 | return IntPtr.Zero; | |
| 185 | 177 | } | |
| 186 | 178 | ||
@@ -228,9 +220,7 @@ public static int mp_ass_subscript(IntPtr ob, IntPtr idx, IntPtr v) | |||
| 228 | 220 | ||
| 229 | 221 | if (cls.indexer == null || !cls.indexer.CanSet) | |
| 230 | 222 | { | |
| 231 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 232 | - "object doesn't support item assignment" | ||
| 233 | - ); | ||
| 223 | + Exceptions.SetError(Exceptions.TypeError, "object doesn't support item assignment"); | ||
| 234 | 224 | return -1; | |
| 235 | 225 | } | |
| 236 | 226 | ||
@@ -314,8 +304,7 @@ public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) | |||
| 314 | 304 | ||
| 315 | 305 | if (cb.type != typeof(System.Delegate)) | |
| 316 | 306 | { | |
| 317 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 318 | - "object is not callable"); | ||
| 307 | + Exceptions.SetError(Exceptions.TypeError, "object is not callable"); | ||
| 319 | 308 | return IntPtr.Zero; | |
| 320 | 309 | } | |
| 321 | 310 | ||
@@ -331,4 +320,4 @@ public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) | |||
| 331 | 320 | return binder.Invoke(ob, args, kw); | |
| 332 | 321 | } | |
| 333 | 322 | } | |
| 334 | - } | ||
| 323 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,4 +49,4 @@ internal TypeBuilder DefineType(string name, Type basetype) | |||
| 49 | 49 | return mBuilder.DefineType(name, attrs, basetype); | |
| 50 | 50 | } | |
| 51 | 51 | } | |
| 52 | - } | ||
| 52 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,8 +49,7 @@ internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw) | |||
| 49 | 49 | /// Binding binding = this.Bind(inst, args, kw, info); | |
| 50 | 50 | /// to take advantage of Bind()'s ability to use a single MethodBase (CI or MI). | |
| 51 | 51 | /// </remarks> | |
| 52 | - internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, | ||
| 53 | - MethodBase info) | ||
| 52 | + internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info) | ||
| 54 | 53 | { | |
| 55 | 54 | Object result; | |
| 56 | 55 | ||
@@ -96,9 +95,7 @@ internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, | |||
| 96 | 95 | ||
| 97 | 96 | if (binding == null) | |
| 98 | 97 | { | |
| 99 | - Exceptions.SetError(Exceptions.TypeError, | ||
| 100 | - "no constructor matches given arguments" | ||
| 101 | - ); | ||
| 98 | + Exceptions.SetError(Exceptions.TypeError, "no constructor matches given arguments"); | ||
| 102 | 99 | return null; | |
| 103 | 100 | } | |
| 104 | 101 | } | |
@@ -123,4 +120,4 @@ internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, | |||
| 123 | 120 | return result; | |
| 124 | 121 | } | |
| 125 | 122 | } | |
| 126 | - } | ||
| 123 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,8 +169,7 @@ internal class BoundContructor : ExtensionType | |||
| 169 | 169 | ConstructorInfo ctorInfo; | |
| 170 | 170 | IntPtr repr; | |
| 171 | 171 | ||
| 172 | - public BoundContructor(Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder, ConstructorInfo ci) | ||
| 173 | - : base() | ||
| 172 | + public BoundContructor(Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder, ConstructorInfo ci) : base() | ||
| 174 | 173 | { | |
| 175 | 174 | this.type = type; | |
| 176 | 175 | Runtime.XIncref(pyTypeHndl); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments