Skip to content

Commit fa77121

Browse files
committed
Refactor
1 parent 39c95c4 commit fa77121

8 files changed

Lines changed: 20 additions & 21 deletions

File tree

ConsoleTest/Program.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
using System.Threading.Tasks;
33
using Python.Runtime;
44
using PythonNETExtensions.Awaiters;
5+
using PythonNETExtensions.Config;
56
using PythonNETExtensions.Core;
67
using PythonNETExtensions.Modules;
78
using PythonNETExtensions.Modules.PythonBuiltIn;
8-
using PythonNETExtensions.PythonConfig;
9-
using PythonNETExtensions.PythonVersions;
9+
using PythonNETExtensions.Versions;
1010

1111
namespace ConsoleTest
1212
{
@@ -27,15 +27,16 @@ private static async Task Main(string[] args)
2727
using (new PythonHandle())
2828
{
2929
var helloWorldText = "Hello World!";
30+
31+
var sys = PythonExtensions.GetPythonModule<SysModule>();
32+
33+
var result = RawPython.Run<string>(
34+
$"""
35+
print({new RawPython.PythonObject(helloWorldText)});
36+
return {new RawPython.PythonObject(sys)}.executable;
37+
""");
3038

31-
new PythonMethodHandle
32-
(
33-
parameters: [ nameof(helloWorldText) ],
34-
methodBody:
35-
$"""
36-
print({nameof(helloWorldText)});
37-
"""
38-
).Method(helloWorldText);
39+
Console.WriteLine(result);
3940

4041
// Numpy module
4142
dynamic np = PythonExtensions.GetPythonModule<Numpy>();

PythonNETExtensions/PythonConfig/DefaultPythonConfig.cs renamed to PythonNETExtensions/Config/DefaultPythonConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace PythonNETExtensions.PythonConfig
1+
namespace PythonNETExtensions.Config
22
{
33
public struct DefaultPythonConfig: IPythonConfig<DefaultPythonConfig>
44
{

PythonNETExtensions/PythonConfig/IPythonConfig.cs renamed to PythonNETExtensions/Config/IPythonConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.IO;
22

3-
namespace PythonNETExtensions.PythonConfig
3+
namespace PythonNETExtensions.Config
44
{
55
public interface IPythonConfig<PyConfigT> where PyConfigT: struct, IPythonConfig<PyConfigT>
66
{

PythonNETExtensions/Core/PythonCore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
using System.Threading;
1111
using System.Threading.Tasks;
1212
using Python.Runtime;
13+
using PythonNETExtensions.Config;
1314
using PythonNETExtensions.Helpers;
1415
using PythonNETExtensions.Modules;
1516
using PythonNETExtensions.Modules.PythonBuiltIn;
16-
using PythonNETExtensions.PythonConfig;
17-
using PythonNETExtensions.PythonVersions;
17+
using PythonNETExtensions.Versions;
1818

1919
namespace PythonNETExtensions.Core
2020
{

PythonNETExtensions/Core/PythonMethodHandle.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Runtime.CompilerServices;
33
using System.Threading;
44
using Python.Runtime;
5-
using PythonNETExtensions.Modules;
65
using PythonNETExtensions.Modules.PythonBuiltIn;
76

87
namespace PythonNETExtensions.Core

PythonNETExtensions/PythonVersions/IPythonVersion.cs renamed to PythonNETExtensions/Versions/IPythonVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Diagnostics;
33
using System.IO;
44
using System.Runtime.CompilerServices;
5-
using PythonNETExtensions.PythonConfig;
5+
using PythonNETExtensions.Config;
66

7-
namespace PythonNETExtensions.PythonVersions
7+
namespace PythonNETExtensions.Versions
88
{
99
public interface IPythonVersion<PyVersionT, PyConfigT>
1010
where PyVersionT: struct, IPythonVersion<PyVersionT, PyConfigT>

PythonNETExtensions/PythonVersions/PlatformEmbeddedPython.cs renamed to PythonNETExtensions/Versions/PlatformEmbeddedPython.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Runtime.InteropServices;
33

4-
namespace PythonNETExtensions.PythonVersions
4+
namespace PythonNETExtensions.Versions
55
{
66
public struct PlatformEmbeddedPython
77
{

PythonNETExtensions/PythonVersions/PyVer3_11.cs renamed to PythonNETExtensions/Versions/PyVer3_11.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System;
2-
using PythonNETExtensions.PythonConfig;
1+
using PythonNETExtensions.Config;
32

4-
namespace PythonNETExtensions.PythonVersions
3+
namespace PythonNETExtensions.Versions
54
{
65
public readonly struct PyVer3_11<PyConfigT>: IPythonVersion<PyVer3_11<PyConfigT>, PyConfigT>
76
where PyConfigT : struct, IPythonConfig<PyConfigT>

0 commit comments

Comments
 (0)