| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + # Line endings normalization | ||
| 2 | + fd7c7e1cbd8e1d7bdb2ec2423c3cf9f95a3abed1 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,13 @@ jobs: | |||
| 36 | 36 | ||
| 37 | 37 | - category: macos | |
| 38 | 38 | platform: x64 | |
| 39 | - instance: macos-13 | ||
| 39 | + instance: macos-14 | ||
| 40 | 40 | ||
| 41 | - python: ["3.10", "3.11", "3.12", "3.13"] | ||
| 41 | + - category: macos | ||
| 42 | + platform: arm64 | ||
| 43 | + instance: macos-14-arm64 | ||
| 44 | + | ||
| 45 | + python: ["3.10", "3.11", "3.12", "3.13", "3.14"] | ||
| 42 | 46 | ||
| 43 | 47 | steps: | |
| 44 | 48 | - name: Set Environment on macOS | |
@@ -53,7 +57,7 @@ jobs: | |||
| 53 | 57 | - name: Setup .NET | |
| 54 | 58 | uses: actions/setup-dotnet@v5 | |
| 55 | 59 | with: | |
| 56 | - dotnet-version: '8.0.x' | ||
| 60 | + dotnet-version: '10.0.x' | ||
| 57 | 61 | ||
| 58 | 62 | - name: Set up Python ${{ matrix.python }} | |
| 59 | 63 | uses: astral-sh/setup-uv@v7 | |
@@ -77,7 +81,7 @@ jobs: | |||
| 77 | 81 | MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466 | |
| 78 | 82 | ||
| 79 | 83 | - name: Embedding tests (.NET Core) | |
| 80 | - run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net8.0 --logger "console;verbosity=detailed" src/embed_tests/ | ||
| 84 | + run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net10.0 --logger "console;verbosity=detailed" src/embed_tests/ | ||
| 81 | 85 | if: always() | |
| 82 | 86 | ||
| 83 | 87 | - name: Python Tests (Mono) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,35 +1,35 @@ | |||
| 1 | - @ECHO OFF | ||
| 2 | - | ||
| 3 | - pushd %~dp0 | ||
| 4 | - | ||
| 5 | - REM Command file for Sphinx documentation | ||
| 6 | - | ||
| 7 | - if "%SPHINXBUILD%" == "" ( | ||
| 8 | - set SPHINXBUILD=sphinx-build | ||
| 9 | - ) | ||
| 10 | - set SOURCEDIR=source | ||
| 11 | - set BUILDDIR=build | ||
| 12 | - | ||
| 13 | - %SPHINXBUILD% >NUL 2>NUL | ||
| 14 | - if errorlevel 9009 ( | ||
| 15 | - echo. | ||
| 16 | - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
| 17 | - echo.installed, then set the SPHINXBUILD environment variable to point | ||
| 18 | - echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
| 19 | - echo.may add the Sphinx directory to PATH. | ||
| 20 | - echo. | ||
| 21 | - echo.If you don't have Sphinx installed, grab it from | ||
| 22 | - echo.https://www.sphinx-doc.org/ | ||
| 23 | - exit /b 1 | ||
| 24 | - ) | ||
| 25 | - | ||
| 26 | - if "%1" == "" goto help | ||
| 27 | - | ||
| 28 | - %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
| 29 | - goto end | ||
| 30 | - | ||
| 31 | - :help | ||
| 32 | - %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
| 33 | - | ||
| 34 | - :end | ||
| 35 | - popd | ||
| 1 | + @ECHO OFF | ||
| 2 | + | ||
| 3 | + pushd %~dp0 | ||
| 4 | + | ||
| 5 | + REM Command file for Sphinx documentation | ||
| 6 | + | ||
| 7 | + if "%SPHINXBUILD%" == "" ( | ||
| 8 | + set SPHINXBUILD=sphinx-build | ||
| 9 | + ) | ||
| 10 | + set SOURCEDIR=source | ||
| 11 | + set BUILDDIR=build | ||
| 12 | + | ||
| 13 | + %SPHINXBUILD% >NUL 2>NUL | ||
| 14 | + if errorlevel 9009 ( | ||
| 15 | + echo. | ||
| 16 | + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
| 17 | + echo.installed, then set the SPHINXBUILD environment variable to point | ||
| 18 | + echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
| 19 | + echo.may add the Sphinx directory to PATH. | ||
| 20 | + echo. | ||
| 21 | + echo.If you don't have Sphinx installed, grab it from | ||
| 22 | + echo.https://www.sphinx-doc.org/ | ||
| 23 | + exit /b 1 | ||
| 24 | + ) | ||
| 25 | + | ||
| 26 | + if "%1" == "" goto help | ||
| 27 | + | ||
| 28 | + %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
| 29 | + goto end | ||
| 30 | + | ||
| 31 | + :help | ||
| 32 | + %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
| 33 | + | ||
| 34 | + :end | ||
| 35 | + popd | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ dependencies = [ | |||
| 13 | 13 | "clr_loader>=0.2.7,<0.3.0" | |
| 14 | 14 | ] | |
| 15 | 15 | ||
| 16 | - requires-python = ">=3.10, <3.14" | ||
| 16 | + requires-python = ">=3.10, <3.15" | ||
| 17 | 17 | ||
| 18 | 18 | classifiers = [ | |
| 19 | 19 | "Development Status :: 5 - Production/Stable", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> | |
| 2 | 2 | ||
| 3 | 3 | <PropertyGroup> | |
| 4 | - <TargetFrameworks>net472;net8.0</TargetFrameworks> | ||
| 4 | + <TargetFrameworks>net472;net10.0</TargetFrameworks> | ||
| 5 | 5 | <AssemblyOriginatorKeyFile>..\pythonnet.snk</AssemblyOriginatorKeyFile> | |
| 6 | 6 | <SignAssembly>true</SignAssembly> | |
| 7 | 7 | </PropertyGroup> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> | |
| 2 | 2 | ||
| 3 | 3 | <PropertyGroup> | |
| 4 | - <TargetFrameworks>net472;net8.0</TargetFrameworks> | ||
| 4 | + <TargetFrameworks>net472;net10.0</TargetFrameworks> | ||
| 5 | 5 | </PropertyGroup> | |
| 6 | 6 | ||
| 7 | 7 | <ItemGroup> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,6 +123,11 @@ private static void AssemblyLoadHandler(object ob, AssemblyLoadEventArgs args) | |||
| 123 | 123 | ||
| 124 | 124 | internal static AssemblyName? TryParseAssemblyName(string name) | |
| 125 | 125 | { | |
| 126 | + // workaround for https://github.com/dotnet/runtime/issues/123951 | ||
| 127 | + if (name.IndexOfAny(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) >= 0) | ||
| 128 | + { | ||
| 129 | + return null; | ||
| 130 | + } | ||
| 126 | 131 | try | |
| 127 | 132 | { | |
| 128 | 133 | return new AssemblyName(name); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,55 +1,55 @@ | |||
| 1 | - using System; | ||
| 2 | - using System.Collections.Generic; | ||
| 3 | - | ||
| 4 | - namespace Python.Runtime.Codecs | ||
| 5 | - { | ||
| 6 | - public class IterableDecoder : IPyObjectDecoder | ||
| 7 | - { | ||
| 8 | - internal static bool IsIterable(Type targetType) | ||
| 9 | - { | ||
| 10 | - //if it is a plain IEnumerable, we can decode it using sequence protocol. | ||
| 11 | - if (targetType == typeof(System.Collections.IEnumerable)) | ||
| 12 | - return true; | ||
| 13 | - | ||
| 14 | - if (!targetType.IsGenericType) | ||
| 15 | - return false; | ||
| 16 | - | ||
| 17 | - return targetType.GetGenericTypeDefinition() == typeof(IEnumerable<>); | ||
| 18 | - } | ||
| 19 | - | ||
| 20 | - internal static bool IsIterable(PyType objectType) | ||
| 21 | - { | ||
| 22 | - return objectType.HasAttr("__iter__"); | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - public bool CanDecode(PyType objectType, Type targetType) | ||
| 26 | - { | ||
| 27 | - return IsIterable(objectType) && IsIterable(targetType); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - public bool TryDecode<T>(PyObject pyObj, out T value) | ||
| 31 | - { | ||
| 32 | - //first see if T is a plan IEnumerable | ||
| 33 | - if (typeof(T) == typeof(System.Collections.IEnumerable)) | ||
| 34 | - { | ||
| 35 | - object enumerable = new CollectionWrappers.IterableWrapper<object>(pyObj); | ||
| 36 | - value = (T)enumerable; | ||
| 37 | - return true; | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - var elementType = typeof(T).GetGenericArguments()[0]; | ||
| 41 | - var collectionType = typeof(CollectionWrappers.IterableWrapper<>).MakeGenericType(elementType); | ||
| 42 | - | ||
| 43 | - var instance = Activator.CreateInstance(collectionType, new[] { pyObj }); | ||
| 44 | - value = (T)instance; | ||
| 45 | - return true; | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - public static IterableDecoder Instance { get; } = new IterableDecoder(); | ||
| 49 | - | ||
| 50 | - public static void Register() | ||
| 51 | - { | ||
| 52 | - PyObjectConversions.RegisterDecoder(Instance); | ||
| 53 | - } | ||
| 54 | - } | ||
| 55 | - } | ||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + | ||
| 4 | + namespace Python.Runtime.Codecs | ||
| 5 | + { | ||
| 6 | + public class IterableDecoder : IPyObjectDecoder | ||
| 7 | + { | ||
| 8 | + internal static bool IsIterable(Type targetType) | ||
| 9 | + { | ||
| 10 | + //if it is a plain IEnumerable, we can decode it using sequence protocol. | ||
| 11 | + if (targetType == typeof(System.Collections.IEnumerable)) | ||
| 12 | + return true; | ||
| 13 | + | ||
| 14 | + if (!targetType.IsGenericType) | ||
| 15 | + return false; | ||
| 16 | + | ||
| 17 | + return targetType.GetGenericTypeDefinition() == typeof(IEnumerable<>); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + internal static bool IsIterable(PyType objectType) | ||
| 21 | + { | ||
| 22 | + return objectType.HasAttr("__iter__"); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public bool CanDecode(PyType objectType, Type targetType) | ||
| 26 | + { | ||
| 27 | + return IsIterable(objectType) && IsIterable(targetType); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public bool TryDecode<T>(PyObject pyObj, out T value) | ||
| 31 | + { | ||
| 32 | + //first see if T is a plan IEnumerable | ||
| 33 | + if (typeof(T) == typeof(System.Collections.IEnumerable)) | ||
| 34 | + { | ||
| 35 | + object enumerable = new CollectionWrappers.IterableWrapper<object>(pyObj); | ||
| 36 | + value = (T)enumerable; | ||
| 37 | + return true; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + var elementType = typeof(T).GetGenericArguments()[0]; | ||
| 41 | + var collectionType = typeof(CollectionWrappers.IterableWrapper<>).MakeGenericType(elementType); | ||
| 42 | + | ||
| 43 | + var instance = Activator.CreateInstance(collectionType, new[] { pyObj }); | ||
| 44 | + value = (T)instance; | ||
| 45 | + return true; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public static IterableDecoder Instance { get; } = new IterableDecoder(); | ||
| 49 | + | ||
| 50 | + public static void Register() | ||
| 51 | + { | ||
| 52 | + PyObjectConversions.RegisterDecoder(Instance); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,50 +1,50 @@ | |||
| 1 | - using System; | ||
| 2 | - using System.Collections.Generic; | ||
| 3 | - | ||
| 4 | - namespace Python.Runtime.Codecs | ||
| 5 | - { | ||
| 6 | - public class ListDecoder : IPyObjectDecoder | ||
| 7 | - { | ||
| 8 | - private static bool IsList(Type targetType) | ||
| 9 | - { | ||
| 10 | - if (!targetType.IsGenericType) | ||
| 11 | - return false; | ||
| 12 | - | ||
| 13 | - return targetType.GetGenericTypeDefinition() == typeof(IList<>); | ||
| 14 | - } | ||
| 15 | - | ||
| 16 | - private static bool IsList(PyType objectType) | ||
| 17 | - { | ||
| 18 | - //TODO accept any python object that implements the sequence and list protocols | ||
| 19 | - //must implement sequence protocol to fully implement list protocol | ||
| 20 | - //if (!SequenceDecoder.IsSequence(objectType)) return false; | ||
| 21 | - | ||
| 22 | - //returns wheter the type is a list. | ||
| 23 | - return PythonReferenceComparer.Instance.Equals(objectType, Runtime.PyListType); | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - public bool CanDecode(PyType objectType, Type targetType) | ||
| 27 | - { | ||
| 28 | - return IsList(objectType) && IsList(targetType); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - public bool TryDecode<T>(PyObject pyObj, out T value) | ||
| 32 | - { | ||
| 33 | - if (pyObj == null) throw new ArgumentNullException(nameof(pyObj)); | ||
| 34 | - | ||
| 35 | - var elementType = typeof(T).GetGenericArguments()[0]; | ||
| 36 | - Type collectionType = typeof(CollectionWrappers.ListWrapper<>).MakeGenericType(elementType); | ||
| 37 | - | ||
| 38 | - var instance = Activator.CreateInstance(collectionType, new[] { pyObj }); | ||
| 39 | - value = (T)instance; | ||
| 40 | - return true; | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - public static ListDecoder Instance { get; } = new ListDecoder(); | ||
| 44 | - | ||
| 45 | - public static void Register() | ||
| 46 | - { | ||
| 47 | - PyObjectConversions.RegisterDecoder(Instance); | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - } | ||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + | ||
| 4 | + namespace Python.Runtime.Codecs | ||
| 5 | + { | ||
| 6 | + public class ListDecoder : IPyObjectDecoder | ||
| 7 | + { | ||
| 8 | + private static bool IsList(Type targetType) | ||
| 9 | + { | ||
| 10 | + if (!targetType.IsGenericType) | ||
| 11 | + return false; | ||
| 12 | + | ||
| 13 | + return targetType.GetGenericTypeDefinition() == typeof(IList<>); | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + private static bool IsList(PyType objectType) | ||
| 17 | + { | ||
| 18 | + //TODO accept any python object that implements the sequence and list protocols | ||
| 19 | + //must implement sequence protocol to fully implement list protocol | ||
| 20 | + //if (!SequenceDecoder.IsSequence(objectType)) return false; | ||
| 21 | + | ||
| 22 | + //returns wheter the type is a list. | ||
| 23 | + return PythonReferenceComparer.Instance.Equals(objectType, Runtime.PyListType); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public bool CanDecode(PyType objectType, Type targetType) | ||
| 27 | + { | ||
| 28 | + return IsList(objectType) && IsList(targetType); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public bool TryDecode<T>(PyObject pyObj, out T value) | ||
| 32 | + { | ||
| 33 | + if (pyObj == null) throw new ArgumentNullException(nameof(pyObj)); | ||
| 34 | + | ||
| 35 | + var elementType = typeof(T).GetGenericArguments()[0]; | ||
| 36 | + Type collectionType = typeof(CollectionWrappers.ListWrapper<>).MakeGenericType(elementType); | ||
| 37 | + | ||
| 38 | + var instance = Activator.CreateInstance(collectionType, new[] { pyObj }); | ||
| 39 | + value = (T)instance; | ||
| 40 | + return true; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public static ListDecoder Instance { get; } = new ListDecoder(); | ||
| 44 | + | ||
| 45 | + public static void Register() | ||
| 46 | + { | ||
| 47 | + PyObjectConversions.RegisterDecoder(Instance); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments