Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f045de

Browse files
committed
Move code to subdirectories and rename or split up
1 parent7450c5c commit1f045de

File tree

113 files changed

+677
-883
lines changed

Some content is hidden

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

113 files changed

+677
-883
lines changed
File renamed without changes.
File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespacePython.Runtime;
2+
3+
usingSystem;
4+
5+
/// <summary>
6+
/// Defines <see cref="PyObject"/> conversion to CLR types (unmarshalling)
7+
/// </summary>
8+
publicinterfaceIPyObjectDecoder
9+
{
10+
/// <summary>
11+
/// Checks if this decoder can decode from <paramref name="objectType"/> to <paramref name="targetType"/>
12+
/// </summary>
13+
boolCanDecode(PyTypeobjectType,TypetargetType);
14+
/// <summary>
15+
/// Attempts do decode <paramref name="pyObj"/> into a variable of specified type
16+
/// </summary>
17+
/// <typeparam name="T">CLR type to decode into</typeparam>
18+
/// <param name="pyObj">Object to decode</param>
19+
/// <param name="value">The variable, that will receive decoding result</param>
20+
/// <returns></returns>
21+
boolTryDecode<T>(PyObjectpyObj,outT?value);
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespacePython.Runtime;
2+
3+
usingSystem;
4+
5+
/// <summary>
6+
/// Defines conversion from CLR objects into Python objects (e.g. <see cref="PyObject"/>) (marshalling)
7+
/// </summary>
8+
publicinterfaceIPyObjectEncoder
9+
{
10+
/// <summary>
11+
/// Checks if encoder can encode CLR objects of specified type
12+
/// </summary>
13+
boolCanEncode(Typetype);
14+
/// <summary>
15+
/// Attempts to encode CLR object <paramref name="value"/> into Python object
16+
/// </summary>
17+
PyObject?TryEncode(objectvalue);
18+
}

‎src/runtime/converterextensions.csrenamed to‎src/runtime/Codecs/PyObjectConversions.cs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,8 @@ namespace Python.Runtime
66
usingSystem.Diagnostics;
77
usingSystem.Linq;
88
usingSystem.Reflection;
9-
usingPython.Runtime.Codecs;
10-
11-
/// <summary>
12-
/// Defines <see cref="PyObject"/> conversion to CLR types (unmarshalling)
13-
/// </summary>
14-
publicinterfaceIPyObjectDecoder
15-
{
16-
/// <summary>
17-
/// Checks if this decoder can decode from <paramref name="objectType"/> to <paramref name="targetType"/>
18-
/// </summary>
19-
boolCanDecode(PyTypeobjectType,TypetargetType);
20-
/// <summary>
21-
/// Attempts do decode <paramref name="pyObj"/> into a variable of specified type
22-
/// </summary>
23-
/// <typeparam name="T">CLR type to decode into</typeparam>
24-
/// <param name="pyObj">Object to decode</param>
25-
/// <param name="value">The variable, that will receive decoding result</param>
26-
/// <returns></returns>
27-
boolTryDecode<T>(PyObjectpyObj,outT?value);
28-
}
299

30-
/// <summary>
31-
/// Defines conversion from CLR objects into Python objects (e.g. <see cref="PyObject"/>) (marshalling)
32-
/// </summary>
33-
publicinterfaceIPyObjectEncoder
34-
{
35-
/// <summary>
36-
/// Checks if encoder can encode CLR objects of specified type
37-
/// </summary>
38-
boolCanEncode(Typetype);
39-
/// <summary>
40-
/// Attempts to encode CLR object <paramref name="value"/> into Python object
41-
/// </summary>
42-
PyObject?TryEncode(objectvalue);
43-
}
10+
usingPython.Runtime.Codecs;
4411

4512
/// <summary>
4613
/// This class allows to register additional marshalling codecs.
File renamed without changes.
File renamed without changes.

‎src/runtime/exceptions.csrenamed to‎src/runtime/Exceptions.cs

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,6 @@
55

66
namespacePython.Runtime
77
{
8-
/// <summary>
9-
/// Base class for Python types that reflect managed exceptions based on
10-
/// System.Exception
11-
/// </summary>
12-
/// <remarks>
13-
/// The Python wrapper for managed exceptions LIES about its inheritance
14-
/// tree. Although the real System.Exception is a subclass of
15-
/// System.Object the Python type for System.Exception does NOT claim that
16-
/// it subclasses System.Object. Instead TypeManager.CreateType() uses
17-
/// Python's exception.Exception class as base class for System.Exception.
18-
/// </remarks>
19-
[Serializable]
20-
internalclassExceptionClassObject:ClassObject
21-
{
22-
internalExceptionClassObject(Typetp):base(tp)
23-
{
24-
}
25-
26-
internalstaticException?ToException(BorrowedReferenceob)
27-
{
28-
varco=GetManagedObject(ob)asCLRObject;
29-
returnco?.instasException;
30-
}
31-
32-
/// <summary>
33-
/// Exception __repr__ implementation
34-
/// </summary>
35-
publicnewstaticNewReferencetp_repr(BorrowedReferenceob)
36-
{
37-
Exception?e=ToException(ob);
38-
if(e==null)
39-
{
40-
returnExceptions.RaiseTypeError("invalid object");
41-
}
42-
stringname=e.GetType().Name;
43-
stringmessage;
44-
if(e.Message!=String.Empty)
45-
{
46-
message=String.Format("{0}('{1}')",name,e.Message);
47-
}
48-
else
49-
{
50-
message=String.Format("{0}()",name);
51-
}
52-
returnRuntime.PyString_FromString(message);
53-
}
54-
55-
/// <summary>
56-
/// Exception __str__ implementation
57-
/// </summary>
58-
publicnewstaticNewReferencetp_str(BorrowedReferenceob)
59-
{
60-
Exception?e=ToException(ob);
61-
if(e==null)
62-
{
63-
returnExceptions.RaiseTypeError("invalid object");
64-
}
65-
66-
stringmessage=e.ToString();
67-
stringfullTypeName=e.GetType().FullName;
68-
stringprefix=fullTypeName+": ";
69-
if(message.StartsWith(prefix))
70-
{
71-
message=message.Substring(prefix.Length);
72-
}
73-
elseif(message.StartsWith(fullTypeName))
74-
{
75-
message=message.Substring(fullTypeName.Length);
76-
}
77-
returnRuntime.PyString_FromString(message);
78-
}
79-
80-
publicoverrideboolInit(BorrowedReferenceobj,BorrowedReferenceargs,BorrowedReferencekw)
81-
{
82-
if(!base.Init(obj,args,kw))returnfalse;
83-
84-
vare=(CLRObject)GetManagedObject(obj)!;
85-
86-
returnExceptions.SetArgsAndCause(obj,(Exception)e.inst);
87-
}
88-
}
898

909
/// <summary>
9110
/// Encapsulates the Python exception APIs.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎src/runtime/ManagedTypes.cd

Lines changed: 0 additions & 196 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎src/runtime/Python.Runtime.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
</ItemGroup>
5151

5252
<ItemGroup>
53-
<EmbeddedResourceInclude="resources\clr.py">
53+
<EmbeddedResourceInclude="Resources\clr.py">
5454
<LogicalName>clr.py</LogicalName>
5555
</EmbeddedResource>
56-
<EmbeddedResourceInclude="resources\interop.py">
56+
<EmbeddedResourceInclude="Resources\interop.py">
5757
<LogicalName>interop.py</LogicalName>
5858
</EmbeddedResource>
5959
<EmbeddedResourceInclude="Mixins\*.py" />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp