Skip to content

Commit 4772128

Browse files
Rebasing
1 parent 090ff9f commit 4772128

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+9651
-2141
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
*.pdb
88
*.deps.json
99

10+
# Ignore package builds
11+
*.nupkg
12+
*.snupkg
13+
1014
### JetBrains ###
1115
.idea/
1216

AUTHORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Christoph Gohlke ([@cgohlke](https://github.com/cgohlke))
3030
- Christopher Bremner ([@chrisjbremner](https://github.com/chrisjbremner))
3131
- Christopher Pow ([@christopherpow](https://github.com/christopherpow))
32+
- Colton Sellers ([@C-SELLERS](https://github.com/C-SELLERS))
3233
- Daniel Abrahamsson ([@danabr](https://github.com/danabr))
3334
- Daniel Fernandez ([@fdanny](https://github.com/fdanny))
3435
- Daniel Santana ([@dgsantana](https://github.com/dgsantana))
@@ -52,6 +53,7 @@
5253
- Luke Stratman ([@lstratman](https://github.com/lstratman))
5354
- Konstantin Posudevskiy ([@konstantin-posudevskiy](https://github.com/konstantin-posudevskiy))
5455
- Matthias Dittrich ([@matthid](https://github.com/matthid))
56+
- Martin Molinero ([@Martin-Molinero](https://github.com/Martin-Molinero))
5557
- Meinrad Recheis ([@henon](https://github.com/henon))
5658
- Mohamed Koubaa ([@koubaa](https://github.com/koubaa))
5759
- Patrick Stewart ([@patstew](https://github.com/patstew))

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ details about the cause of the failure
4141
able to access members that are part of the implementation class, but not the
4242
interface. Use the new `__implementation__` or `__raw_implementation__` properties to
4343
if you need to "downcast" to the implementation class.
44+
4445
- BREAKING: Parameters marked with `ParameterAttributes.Out` are no longer returned in addition
4546
to the regular method return value (unless they are passed with `ref` or `out` keyword).
4647
- BREAKING: Drop support for the long-deprecated CLR.* prefix.

Directory.Build.props

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,4 @@
77
<LangVersion>10.0</LangVersion>
88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
10-
<ItemGroup>
11-
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
12-
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.1">
13-
<PrivateAssets>all</PrivateAssets>
14-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
15-
</PackageReference>
16-
<PackageReference Include="NonCopyableAnalyzer" Version="0.7.0">
17-
<PrivateAssets>all</PrivateAssets>
18-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19-
</PackageReference>
20-
</ItemGroup>
2110
</Project>

pythonnet.sln

Lines changed: 29 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test", "src\testing\
1212
EndProject
1313
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.PerformanceTests", "src\perf_tests\Python.PerformanceTests.csproj", "{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}"
1414
EndProject
15-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.DomainReloadTests", "tests\domain_tests\Python.DomainReloadTests.csproj", "{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}"
16-
EndProject
1715
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Repo", "Repo", "{441A0123-F4C6-4EE4-9AEE-315FD79BE2D5}"
1816
ProjectSection(SolutionItems) = preProject
1917
.editorconfig = .editorconfig
@@ -42,11 +40,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{BC426F42
4240
EndProject
4341
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.PythonTestsRunner", "src\python_tests_runner\Python.PythonTestsRunner.csproj", "{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}"
4442
EndProject
45-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{142A6752-C2C2-4F95-B982-193418001B65}"
46-
ProjectSection(SolutionItems) = preProject
47-
Directory.Build.props = Directory.Build.props
48-
EndProjectSection
49-
EndProject
5043
Global
5144
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5245
Debug|Any CPU = Debug|Any CPU
@@ -72,30 +65,27 @@ Global
7265
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.Release|x64.Build.0 = Release|Any CPU
7366
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.Release|x86.ActiveCfg = Release|Any CPU
7467
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.Release|x86.Build.0 = Release|Any CPU
75-
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|Any CPU.ActiveCfg = TraceAlloc|Any CPU
76-
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|Any CPU.Build.0 = TraceAlloc|Any CPU
77-
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|x64.ActiveCfg = Debug|Any CPU
78-
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|x64.Build.0 = Debug|Any CPU
79-
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|x86.ActiveCfg = Debug|Any CPU
80-
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|x86.Build.0 = Debug|Any CPU
81-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|Any CPU.ActiveCfg = Debug|x64
82-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|Any CPU.Build.0 = Debug|x64
68+
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|Any CPU.ActiveCfg = Release|Any CPU
69+
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|x64.ActiveCfg = Release|Any CPU
70+
{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}.TraceAlloc|x86.ActiveCfg = Release|Any CPU
71+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
8373
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|x64.ActiveCfg = Debug|x64
8474
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|x64.Build.0 = Debug|x64
8575
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|x86.ActiveCfg = Debug|x86
8676
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Debug|x86.Build.0 = Debug|x86
87-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|Any CPU.ActiveCfg = Release|x64
88-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|Any CPU.Build.0 = Release|x64
77+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
78+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|Any CPU.Build.0 = Release|Any CPU
8979
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|x64.ActiveCfg = Release|x64
9080
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|x64.Build.0 = Release|x64
9181
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|x86.ActiveCfg = Release|x86
9282
{E6B01706-00BA-4144-9029-186AC42FBE9A}.Release|x86.Build.0 = Release|x86
93-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|Any CPU.ActiveCfg = Debug|x64
94-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|Any CPU.Build.0 = Debug|x64
95-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x64.ActiveCfg = Debug|x64
96-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x64.Build.0 = Debug|x64
97-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x86.ActiveCfg = Debug|x86
98-
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x86.Build.0 = Debug|x86
83+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|Any CPU.ActiveCfg = Release|Any CPU
84+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|Any CPU.Build.0 = Release|Any CPU
85+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x64.ActiveCfg = Release|x64
86+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x64.Build.0 = Release|x64
87+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x86.ActiveCfg = Release|x86
88+
{E6B01706-00BA-4144-9029-186AC42FBE9A}.TraceAlloc|x86.Build.0 = Release|x86
9989
{819E089B-4770-400E-93C6-4F7A35F0EA12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
10090
{819E089B-4770-400E-93C6-4F7A35F0EA12}.Debug|Any CPU.Build.0 = Debug|Any CPU
10191
{819E089B-4770-400E-93C6-4F7A35F0EA12}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -126,48 +116,30 @@ Global
126116
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.Release|x64.Build.0 = Release|Any CPU
127117
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.Release|x86.ActiveCfg = Release|Any CPU
128118
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.Release|x86.Build.0 = Release|Any CPU
129-
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|Any CPU.ActiveCfg = Debug|Any CPU
130-
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|Any CPU.Build.0 = Debug|Any CPU
131-
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x64.ActiveCfg = Debug|Any CPU
132-
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x64.Build.0 = Debug|Any CPU
133-
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x86.ActiveCfg = Debug|Any CPU
134-
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x86.Build.0 = Debug|Any CPU
135-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|Any CPU.ActiveCfg = Debug|x64
136-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|Any CPU.Build.0 = Debug|x64
119+
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|Any CPU.ActiveCfg = Release|Any CPU
120+
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|Any CPU.Build.0 = Release|Any CPU
121+
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x64.ActiveCfg = Release|Any CPU
122+
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x64.Build.0 = Release|Any CPU
123+
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x86.ActiveCfg = Release|Any CPU
124+
{14EF9518-5BB7-4F83-8686-015BD2CC788E}.TraceAlloc|x86.Build.0 = Release|Any CPU
125+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
126+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|Any CPU.Build.0 = Debug|Any CPU
137127
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|x64.ActiveCfg = Debug|x64
138128
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|x64.Build.0 = Debug|x64
139129
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|x86.ActiveCfg = Debug|x86
140130
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Debug|x86.Build.0 = Debug|x86
141-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|Any CPU.ActiveCfg = Release|x64
142-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|Any CPU.Build.0 = Release|x64
131+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|Any CPU.ActiveCfg = Release|Any CPU
132+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|Any CPU.Build.0 = Release|Any CPU
143133
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|x64.ActiveCfg = Release|x64
144134
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|x64.Build.0 = Release|x64
145135
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|x86.ActiveCfg = Release|x86
146136
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.Release|x86.Build.0 = Release|x86
147-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|Any CPU.ActiveCfg = Debug|x64
148-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|Any CPU.Build.0 = Debug|x64
149-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x64.ActiveCfg = Debug|x64
150-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x64.Build.0 = Debug|x64
151-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x86.ActiveCfg = Debug|x86
152-
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x86.Build.0 = Debug|x86
153-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
154-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
155-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Debug|x64.ActiveCfg = Debug|Any CPU
156-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Debug|x64.Build.0 = Debug|Any CPU
157-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Debug|x86.ActiveCfg = Debug|Any CPU
158-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Debug|x86.Build.0 = Debug|Any CPU
159-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
160-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|Any CPU.Build.0 = Release|Any CPU
161-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x64.ActiveCfg = Release|Any CPU
162-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x64.Build.0 = Release|Any CPU
163-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x86.ActiveCfg = Release|Any CPU
164-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x86.Build.0 = Release|Any CPU
165-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.TraceAlloc|Any CPU.ActiveCfg = Debug|Any CPU
166-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.TraceAlloc|Any CPU.Build.0 = Debug|Any CPU
167-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.TraceAlloc|x64.ActiveCfg = Debug|Any CPU
168-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.TraceAlloc|x64.Build.0 = Debug|Any CPU
169-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.TraceAlloc|x86.ActiveCfg = Debug|Any CPU
170-
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.TraceAlloc|x86.Build.0 = Debug|Any CPU
137+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|Any CPU.ActiveCfg = Release|Any CPU
138+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|Any CPU.Build.0 = Release|Any CPU
139+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x64.ActiveCfg = Release|x64
140+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x64.Build.0 = Release|x64
141+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x86.ActiveCfg = Release|x86
142+
{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}.TraceAlloc|x86.Build.0 = Release|x86
171143
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
172144
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|Any CPU.Build.0 = Debug|Any CPU
173145
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|x64.ActiveCfg = Debug|Any CPU

src/console/Console.csproj

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
4-
<Platforms>x64;x86</Platforms>
3+
<TargetFrameworks>net5.0</TargetFrameworks>
54
<OutputType>Exe</OutputType>
65
<AssemblyName>nPython</AssemblyName>
76
<RootNamespace>Python.Runtime</RootNamespace>
87
<PackageId>nPython</PackageId>
98
<ApplicationIcon>python-clear.ico</ApplicationIcon>
109
</PropertyGroup>
1110

12-
<ItemGroup>
13-
<Content Include="python-clear.ico" />
14-
<EmbeddedResource Condition="'$(TargetFramework)'=='net40'" Include="$(PythonBuildDir)\Python.Runtime.dll">
15-
<LogicalName>Python.Runtime.dll</LogicalName>
16-
</EmbeddedResource>
17-
</ItemGroup>
1811
<ItemGroup>
1912
<ProjectReference Include="..\runtime\Python.Runtime.csproj" />
2013
</ItemGroup>
2114
<ItemGroup>
22-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0">
23-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24-
<PrivateAssets>all</PrivateAssets>
25-
</PackageReference>
15+
<Content Include="python-clear.ico" />
2616
</ItemGroup>
2717
</Project>

src/embed_tests/Python.EmbeddingTest.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net5.0</TargetFrameworks>
55
<AssemblyOriginatorKeyFile>..\pythonnet.snk</AssemblyOriginatorKeyFile>
66
<SignAssembly>true</SignAssembly>
77
</PropertyGroup>
@@ -24,12 +24,7 @@
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
</PackageReference>
27-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
28-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Condition="$(MSBuildRuntimeType) == 'Core'">
29-
<Version>1.0.0</Version>
30-
<PrivateAssets>all</PrivateAssets>
31-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
32-
</PackageReference>
27+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
3328
</ItemGroup>
3429

3530
</Project>

src/embed_tests/QCTest.cs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using NUnit.Framework;
6+
using Python.Runtime;
7+
8+
namespace Python.EmbeddingTest
9+
{
10+
class QCTests
11+
{
12+
private static dynamic module;
13+
private static string testModule = @"
14+
from clr import AddReference
15+
AddReference(""System"")
16+
AddReference(""Python.EmbeddingTest"")
17+
from Python.EmbeddingTest import Algo, Insight
18+
class PythonModule(Algo):
19+
def TestA(self):
20+
try:
21+
self.EmitInsights(Insight.Group(Insight()))
22+
return True
23+
except:
24+
return False
25+
";
26+
27+
[OneTimeSetUp]
28+
public void Setup()
29+
{
30+
PythonEngine.Initialize();
31+
module = PythonEngine.ModuleFromString("module", testModule).GetAttr("PythonModule").Invoke();
32+
}
33+
34+
[OneTimeTearDown]
35+
public void TearDown()
36+
{
37+
PythonEngine.Shutdown();
38+
}
39+
40+
[Test]
41+
/// Test case for issue with params
42+
/// Highlights case where params argument is a CLR object wrapped in Python
43+
/// https://quantconnect.slack.com/archives/G51920EN4/p1615418516028900
44+
public void ParamTest()
45+
{
46+
var output = (bool)module.TestA();
47+
Assert.IsTrue(output);
48+
}
49+
}
50+
51+
public class Algo
52+
{
53+
/// <param name="insight">The insight to be emitted</s>
54+
public void EmitInsights(Insight insight)
55+
{
56+
EmitInsights(new[] { insight });
57+
}
58+
59+
/// <param name="insights">The array of insights to be emitted</param>
60+
public void EmitInsights(params Insight[] insights)
61+
{
62+
foreach (var insight in insights)
63+
{
64+
Console.WriteLine(insight.info);
65+
}
66+
}
67+
68+
}
69+
70+
public class Insight
71+
{
72+
public string info;
73+
public Insight()
74+
{
75+
info = "pepe";
76+
}
77+
78+
/// <param name="insight">The insight to be grouped</param>
79+
public static IEnumerable<Insight> Group(Insight insight) => Group(new[] { insight });
80+
81+
/// <param name="insights">The insights to be grouped</param>
82+
public static IEnumerable<Insight> Group(params Insight[] insights)
83+
{
84+
if (insights == null)
85+
{
86+
throw new ArgumentNullException(nameof(insights));
87+
}
88+
89+
return insights;
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)