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
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
/pythonnetPublic archive
forked frompythonnet/pythonnet

Commitec678f7

Browse files
committed
Refactor license, fix typo
1 parent5631442 commitec678f7

File tree

89 files changed

+508
-1220
lines changed

Some content is hidden

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

89 files changed

+508
-1220
lines changed

‎src/clrmodule/ClrModule.cs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
9-
1+

102
//============================================================================
113
// This file replaces the hand-maintained stub that used to implement clr.dll.
124
// This is a line-by-line port from IL back to C#.
@@ -21,7 +13,7 @@
2113
// If defined, the "pythonRuntimeVersionString" variable must be set to
2214
// Python.Runtime's current version.
2315

24-
#define USE_PYTHON_RUNTIME_VERSION
16+
#define USE_PYTHON_RUNTIME_VERSION
2517

2618
// If defined, the "PythonRuntimePublicKeyTokenData" data array must be
2719
// set to Python.Runtime's public key token. (sn -T Python.Runtin.dll)
@@ -32,21 +24,21 @@
3224
//============================================================================
3325
usingSystem;
3426

35-
// ReSharper disable CheckNamespace
36-
// ReSharper disable InconsistentNaming
27+
28+
3729
publicclassclrModule
38-
// ReSharper restore InconsistentNaming
39-
// ReSharper restore CheckNamespace
30+
31+
4032
{
41-
// ReSharper disable InconsistentNaming
33+
4234
#if(PYTHON32||PYTHON33||PYTHON34||PYTHON35)
4335
[RGiesecke.DllExport.DllExport("PyInit_clr",System.Runtime.InteropServices.CallingConvention.StdCall)]
4436
publicstaticIntPtrPyInit_clr()
4537
#else
4638
[RGiesecke.DllExport.DllExport("initclr",System.Runtime.InteropServices.CallingConvention.StdCall)]
4739
publicstaticvoidinitclr()
4840
#endif
49-
// ReSharper restore InconsistentNaming
41+
5042
{
5143
#ifDEBUG_PRINT
5244
System.Console.WriteLine("Attempting to load Python.Runtime using standard binding rules... ");
@@ -64,7 +56,7 @@ public static void initclr()
6456
varpythonRuntimeName=newSystem.Reflection.AssemblyName("Python.Runtime")
6557
{
6658
#ifUSE_PYTHON_RUNTIME_VERSION
67-
Version=newSystem.Version("4.0.0.1"),
59+
Version=newSystem.Version("4.0.0.1"),
6860
#endif
6961
CultureInfo= System.Globalization.CultureInfo.InvariantCulture,
7062
};

‎src/console/assemblyinfo.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
91

102
usingSystem;
113
usingSystem.Reflection;
@@ -21,7 +13,7 @@
2113
[assembly:ComVisible(false)]
2214

2315

24-
[assembly:PermissionSetAttribute(SecurityAction.RequestMinimum,
16+
[assembly:PermissionSetAttribute(SecurityAction.RequestMinimum,
2517
Name="FullTrust")]
2618
[assembly:AssemblyDescriptionAttribute("")]
2719
[assembly:AssemblyCopyrightAttribute("Zope Public License, Version 2.0 (ZPL)")]

‎src/console/pythonconsole.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
91

102
usingSystem;
113
usingSystem.Reflection;

‎src/runtime/arrayobject.cs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
91

102
usingSystem;
113
usingSystem.Collections;
@@ -15,7 +7,7 @@ namespace Python.Runtime {
157

168
/// <summary>
179
/// Implements a Python type for managed arrays. This type is essentially
18-
/// the same as a ClassObject, except that it provides sequence semantics
10+
/// the same as a ClassObject, except that it provides sequence semantics
1911
/// to support natural array usage (indexing) from Python.
2012
/// </summary>
2113

@@ -57,7 +49,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) {
5749
// Note that CLR 1.0 only supports int indexes - methods to
5850
// support long indices were introduced in 1.1. We could
5951
// support long indices automatically, but given that long
60-
// indices are not backward compatible and a relative edge
52+
// indices are not backward compatible and a relative edge
6153
// case, we won't bother for now.
6254

6355
// Single-dimensional arrays are the most common case and are
@@ -81,7 +73,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) {
8173
Exceptions.SetError(Exceptions.IndexError,
8274
"array index out of range"
8375
);
84-
returnIntPtr.Zero;
76+
returnIntPtr.Zero;
8577
}
8678

8779
returnConverter.ToPython(items.GetValue(index),itemType);
@@ -122,7 +114,7 @@ public static IntPtr mp_subscript(IntPtr ob, IntPtr idx) {
122114
Exceptions.SetError(Exceptions.IndexError,
123115
"array index out of range"
124116
);
125-
returnIntPtr.Zero;
117+
returnIntPtr.Zero;
126118
}
127119

128120
returnConverter.ToPython(value,itemType);
@@ -169,7 +161,7 @@ public static int mp_ass_subscript(IntPtr ob, IntPtr idx, IntPtr v) {
169161
Exceptions.SetError(Exceptions.IndexError,
170162
"array index out of range"
171163
);
172-
return-1;
164+
return-1;
173165
}
174166

175167
return0;
@@ -247,6 +239,6 @@ public static int mp_length(IntPtr ob) {
247239
}
248240

249241

250-
}
242+
}
251243

252244
}

‎src/runtime/assemblyinfo.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
91

102
usingSystem;
113
usingSystem.Reflection;

‎src/runtime/assemblymanager.cs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
91

102
usingSystem;
113
usingSystem.IO;
@@ -19,7 +11,7 @@
1911
namespacePython.Runtime{
2012

2113
/// <summary>
22-
/// The AssemblyManager maintains information about loaded assemblies
14+
/// The AssemblyManager maintains information about loaded assemblies
2315
/// namespaces and provides an interface for name-based type lookup.
2416
/// </summary>
2517

@@ -42,7 +34,7 @@ private AssemblyManager() {}
4234
//===================================================================
4335

4436
internalstaticvoidInitialize(){
45-
namespaces=new
37+
namespaces=new
4638
Dictionary<string,Dictionary<Assembly,string>>(32);
4739
probed=newDictionary<string,int>(32);
4840
//generics = new Dictionary<string, Dictionary<string, string>>();
@@ -54,7 +46,7 @@ internal static void Initialize() {
5446
lhandler=newAssemblyLoadEventHandler(AssemblyLoadHandler);
5547
domain.AssemblyLoad+=lhandler;
5648

57-
rhandler=newResolveEventHandler(ResolveHandler);
49+
rhandler=newResolveEventHandler(ResolveHandler);
5850
domain.AssemblyResolve+=rhandler;
5951

6052
Assembly[]items=domain.GetAssemblies();
@@ -85,10 +77,10 @@ internal static void Shutdown() {
8577

8678

8779
//===================================================================
88-
// Event handler for assembly load events. At the time the Python
80+
// Event handler for assembly load events. At the time the Python
8981
// runtime loads, we scan the app domain to map the assemblies that
9082
// are loaded at the time. We also have to register this event handler
91-
// so that we can know about assemblies that get loaded after the
83+
// so that we can know about assemblies that get loaded after the
9284
// Python runtime is initialized.
9385
//===================================================================
9486

@@ -122,11 +114,11 @@ static Assembly ResolveHandler(Object ob, ResolveEventArgs args){
122114

123115
//===================================================================
124116
// We __really__ want to avoid using Python objects or APIs when
125-
// probing for assemblies to load, since our ResolveHandler may be
117+
// probing for assemblies to load, since our ResolveHandler may be
126118
// called in contexts where we don't have the Python GIL and can't
127119
// even safely try to get it without risking a deadlock ;(
128120
//
129-
// To work around that, we update a managed copy of sys.path (which
121+
// To work around that, we update a managed copy of sys.path (which
130122
// is the main thing we care about) when UpdatePath is called. The
131123
// import hook calls this whenever it knows its about to use the
132124
// assembly manager, which lets us keep up with changes to sys.path
@@ -216,11 +208,11 @@ public static Assembly LoadAssemblyPath(string name) {
216208
returnassembly;
217209
}
218210

219-
/// <summary>
220-
/// Loads an assembly using full path.
221-
/// </summary>
222-
/// <param name="name"></param>
223-
/// <returns></returns>
211+
/// <summary>
212+
/// Loads an assembly using full path.
213+
/// </summary>
214+
/// <param name="name"></param>
215+
/// <returns></returns>
224216
publicstaticAssemblyLoadAssemblyFullPath(stringname){
225217
Assemblyassembly=null;
226218
if(Path.IsPathRooted(name)){
@@ -249,7 +241,7 @@ public static Assembly FindLoadedAssembly(string name) {
249241
}
250242

251243
//===================================================================
252-
// Given a qualified name of the form A.B.C.D, attempt to load
244+
// Given a qualified name of the form A.B.C.D, attempt to load
253245
// an assembly named after each of A.B.C.D, A.B.C, A.B, A. This
254246
// will only actually probe for the assembly once for each unique
255247
// namespace. Returns true if any assemblies were loaded.
@@ -304,7 +296,7 @@ public static bool LoadImplicit(string name, bool warn=true) {
304296
//===================================================================
305297
// Scans an assembly for exported namespaces, adding them to the
306298
// mapping of valid namespaces. Note that for a given namespace
307-
// a.b.c.d, each of a, a.b, a.b.c and a.b.c.d are considered to
299+
// a.b.c.d, each of a, a.b, a.b.c and a.b.c.d are considered to
308300
// be valid namespaces (to better match Python import semantics).
309301
//===================================================================
310302

@@ -402,7 +394,7 @@ public static List<string> GetNames(string nsname) {
402394
//string tail = key.Substring(nslen);
403395
if(key.IndexOf('.')==-1){
404396
names.Add(key);
405-
}
397+
}
406398
}
407399
}
408400
}

‎src/runtime/classbase.cs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
91

102
usingSystem;
113
usingSystem.Collections;
@@ -49,15 +41,15 @@ public static int tp_init(IntPtr ob, IntPtr args, IntPtr kw) {
4941
//====================================================================
5042
// Default implementation of [] semantics for reflected types.
5143
//====================================================================
52-
44+
5345
publicvirtualIntPtrtype_subscript(IntPtridx){
5446
Type[]types=Runtime.PythonArgsToTypeArray(idx);
5547
if(types==null){
5648
returnExceptions.RaiseTypeError("type(s) expected");
57-
}
58-
59-
Typetarget=GenericUtil.GenericForType(this.type,types.Length);
60-
49+
}
50+
51+
Typetarget=GenericUtil.GenericForType(this.type,types.Length);
52+
6153
if(target!=null){
6254
Typet=target.MakeGenericType(types);
6355
ManagedTypec=(ManagedType)ClassManager.GetClass(t);
@@ -66,7 +58,7 @@ public virtual IntPtr type_subscript(IntPtr idx) {
6658
}
6759

6860
returnExceptions.RaiseTypeError("no type matches params");
69-
}
61+
}
7062

7163
//====================================================================
7264
// Standard comparison implementation for instances of reflected types.
@@ -151,7 +143,7 @@ public static IntPtr tp_iter(IntPtr ob) {
151143
}
152144
else{
153145
o=co.instasIEnumerator;
154-
146+
155147
if(o==null){
156148
stringmessage="iteration over non-sequence";
157149
returnExceptions.RaiseTypeError(message);
@@ -221,7 +213,7 @@ public static int tp_is_gc(IntPtr type) {
221213
publicstaticvoidtp_dealloc(IntPtrob){
222214
ManagedTypeself=GetManagedObject(ob);
223215
IntPtrdict=Marshal.ReadIntPtr(ob,ObjectOffset.DictOffset(ob));
224-
if(dict!=IntPtr.Zero){
216+
if(dict!=IntPtr.Zero){
225217
Runtime.Decref(dict);
226218
}
227219
Runtime.PyObject_GC_UnTrack(self.pyHandle);
@@ -231,6 +223,6 @@ public static void tp_dealloc(IntPtr ob) {
231223
}
232224

233225

234-
}
226+
}
235227

236228
}

‎src/runtime/classderived.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
// ==========================================================================
2-
// This software is subject to the provisions of the Zope Public License,
3-
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
// FOR A PARTICULAR PURPOSE.
8-
// ==========================================================================
9-
1+

102
usingSystem;
113
usingSystem.IO;
124
usingSystem.Reflection;
@@ -22,8 +14,8 @@ namespace Python.Runtime
2214

2315
/// <summary>
2416
/// Managed class that provides the implementation for reflected types.
25-
/// Managed classes and value types are represented in Python by actual
26-
/// Python type objects. Each of those type objects is associated with
17+
/// Managed classes and value types are represented in Python by actual
18+
/// Python type objects. Each of those type objects is associated with
2719
/// an instance of ClassObject, which provides its implementation.
2820
/// </summary>
2921

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp