| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,9 @@ | |||
| 1 | 1 | using System; | |
| 2 | 2 | using System.Collections; | |
| 3 | - using System.IO; | ||
| 4 | 3 | using System.Collections.Concurrent; | |
| 5 | 4 | using System.Collections.Generic; | |
| 6 | 5 | using System.Diagnostics; | |
| 6 | + using System.IO; | ||
| 7 | 7 | using System.Reflection; | |
| 8 | 8 | using System.Threading; | |
| 9 | 9 | ||
@@ -323,9 +323,8 @@ public static bool LoadImplicit(string name, bool warn = true) | |||
| 323 | 323 | if (warn && loaded) | |
| 324 | 324 | { | |
| 325 | 325 | string location = Path.GetFileNameWithoutExtension(lastAssembly.Location); | |
| 326 | - string deprWarning = $@" | ||
| 327 | - The module was found, but not in a referenced namespace. | ||
| 328 | - Implicit loading is deprecated. Please use clr.AddReference(""{location}"")."; | ||
| 326 | + string deprWarning = "The module was found, but not in a referenced namespace.\n" + | ||
| 327 | + $"Implicit loading is deprecated. Please use clr.AddReference('{location}')."; | ||
| 329 | 328 | Exceptions.deprecation(deprWarning); | |
| 330 | 329 | } | |
| 331 | 330 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -199,8 +199,7 @@ public static IntPtr tp_iter(IntPtr ob) | |||
| 199 | 199 | ||
| 200 | 200 | if (o == null) | |
| 201 | 201 | { | |
| 202 | - var message = "iteration over non-sequence"; | ||
| 203 | - return Exceptions.RaiseTypeError(message); | ||
| 202 | + return Exceptions.RaiseTypeError("iteration over non-sequence"); | ||
| 204 | 203 | } | |
| 205 | 204 | } | |
| 206 | 205 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -737,7 +737,7 @@ public static void InvokeMethodVoid(IPythonDerivedType obj, string methodName, s | |||
| 737 | 737 | ||
| 738 | 738 | if (origMethodName == null) | |
| 739 | 739 | { | |
| 740 | - throw new NotImplementedException("Python object does not have a '" + methodName + "' method"); | ||
| 740 | + throw new NotImplementedException($"Python object does not have a '{methodName}' method"); | ||
| 741 | 741 | } | |
| 742 | 742 | ||
| 743 | 743 | obj.GetType().InvokeMember(origMethodName, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,8 +104,7 @@ public static IntPtr mp_subscript(IntPtr op, IntPtr key) | |||
| 104 | 104 | ConstructorInfo ci = self.type.GetConstructor(types); | |
| 105 | 105 | if (ci == null) | |
| 106 | 106 | { | |
| 107 | - var msg = "No match found for constructor signature"; | ||
| 108 | - return Exceptions.RaiseTypeError(msg); | ||
| 107 | + return Exceptions.RaiseTypeError("No match found for constructor signature"); | ||
| 109 | 108 | } | |
| 110 | 109 | var boundCtor = new BoundContructor(self.type, self.pyTypeHndl, self.ctorBinder, ci); | |
| 111 | 110 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,9 @@ | |||
| 1 | 1 | using System; | |
| 2 | + using System.Collections; | ||
| 3 | + using System.Globalization; | ||
| 2 | 4 | using System.Reflection; | |
| 3 | 5 | using System.Runtime.InteropServices; | |
| 4 | - using System.Globalization; | ||
| 5 | 6 | using System.Security; | |
| 6 | - using System.Collections; | ||
| 7 | 7 | ||
| 8 | 8 | namespace Python.Runtime | |
| 9 | 9 | { | |
@@ -292,9 +292,7 @@ internal static bool ToManagedValue(IntPtr value, Type obType, | |||
| 292 | 292 | result = tmp; | |
| 293 | 293 | return true; | |
| 294 | 294 | } | |
| 295 | - var err = "value cannot be converted to {0}"; | ||
| 296 | - err = string.Format(err, obType); | ||
| 297 | - Exceptions.SetError(Exceptions.TypeError, err); | ||
| 295 | + Exceptions.SetError(Exceptions.TypeError, $"value cannot be converted to {obType}"); | ||
| 298 | 296 | return false; | |
| 299 | 297 | } | |
| 300 | 298 | if (mt is ClassBase) | |
@@ -793,10 +791,8 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo | |||
| 793 | 791 | ||
| 794 | 792 | if (setError) | |
| 795 | 793 | { | |
| 796 | - var format = "'{0}' value cannot be converted to {1}"; | ||
| 797 | 794 | string tpName = Runtime.PyObject_GetTypeName(value); | |
| 798 | - string error = string.Format(format, tpName, obType); | ||
| 799 | - Exceptions.SetError(Exceptions.TypeError, error); | ||
| 795 | + Exceptions.SetError(Exceptions.TypeError, $"'{tpName}' value cannot be converted to {obType}"); | ||
| 800 | 796 | } | |
| 801 | 797 | ||
| 802 | 798 | return false; | |
@@ -805,8 +801,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo | |||
| 805 | 801 | ||
| 806 | 802 | if (setError) | |
| 807 | 803 | { | |
| 808 | - var error = "value too large to convert"; | ||
| 809 | - Exceptions.SetError(Exceptions.OverflowError, error); | ||
| 804 | + Exceptions.SetError(Exceptions.OverflowError, "value too large to convert"); | ||
| 810 | 805 | } | |
| 811 | 806 | ||
| 812 | 807 | return false; | |
@@ -818,8 +813,7 @@ private static void SetConversionError(IntPtr value, Type target) | |||
| 818 | 813 | IntPtr ob = Runtime.PyObject_Repr(value); | |
| 819 | 814 | string src = Runtime.GetManagedString(ob); | |
| 820 | 815 | Runtime.XDecref(ob); | |
| 821 | - string error = string.Format("Cannot convert {0} to {1}", src, target); | ||
| 822 | - Exceptions.SetError(Exceptions.TypeError, error); | ||
| 816 | + Exceptions.SetError(Exceptions.TypeError, $"Cannot convert {src} to {target}"); | ||
| 823 | 817 | } | |
| 824 | 818 | ||
| 825 | 819 | ||
@@ -901,8 +895,7 @@ private static bool ToEnum(IntPtr value, Type obType, out object result, bool se | |||
| 901 | 895 | ||
| 902 | 896 | if (setError) | |
| 903 | 897 | { | |
| 904 | - var error = "invalid enumeration value"; | ||
| 905 | - Exceptions.SetError(Exceptions.ValueError, error); | ||
| 898 | + Exceptions.SetError(Exceptions.ValueError, "invalid enumeration value"); | ||
| 906 | 899 | } | |
| 907 | 900 | ||
| 908 | 901 | return false; | |
| 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 System.Runtime.InteropServices; | |
| 5 | 6 | ||
@@ -396,7 +397,7 @@ public static Assembly AddReference(string name) | |||
| 396 | 397 | } | |
| 397 | 398 | if (assembly == null) | |
| 398 | 399 | { | |
| 399 | - throw new System.IO.FileNotFoundException($"Unable to find assembly '{name}'."); | ||
| 400 | + throw new FileNotFoundException($"Unable to find assembly '{name}'."); | ||
| 400 | 401 | } | |
| 401 | 402 | ||
| 402 | 403 | return assembly; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments