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

Commitda7fc0c

Browse files
authored
Merge pull request#2668 from pythonnet/fix-whitespace
Fix line endings
2 parents9a3c04e +08e1b37 commitda7fc0c

File tree

8 files changed

+255
-253
lines changed

8 files changed

+255
-253
lines changed

‎.git-blame-ignore-revs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Line endings normalization
2+
fd7c7e1cbd8e1d7bdb2ec2423c3cf9f95a3abed1

‎doc/make.bat‎

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
@ECHOOFF
2-
3-
pushd%~dp0
4-
5-
REM Command file for Sphinx documentation
6-
7-
if"%SPHINXBUILD%"=="" (
8-
setSPHINXBUILD=sphinx-build
9-
)
10-
setSOURCEDIR=source
11-
setBUILDDIR=build
12-
13-
%SPHINXBUILD%>NUL2>NUL
14-
iferrorlevel9009 (
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 /b1
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+
@ECHOOFF
2+
3+
pushd%~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if"%SPHINXBUILD%"=="" (
8+
setSPHINXBUILD=sphinx-build
9+
)
10+
setSOURCEDIR=source
11+
setBUILDDIR=build
12+
13+
%SPHINXBUILD%>NUL2>NUL
14+
iferrorlevel9009 (
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 /b1
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
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
usingSystem;
2-
usingSystem.Collections.Generic;
3-
4-
namespacePython.Runtime.Codecs
5-
{
6-
publicclassIterableDecoder:IPyObjectDecoder
7-
{
8-
internalstaticboolIsIterable(TypetargetType)
9-
{
10-
//if it is a plain IEnumerable, we can decode it using sequence protocol.
11-
if(targetType==typeof(System.Collections.IEnumerable))
12-
returntrue;
13-
14-
if(!targetType.IsGenericType)
15-
returnfalse;
16-
17-
returntargetType.GetGenericTypeDefinition()==typeof(IEnumerable<>);
18-
}
19-
20-
internalstaticboolIsIterable(PyTypeobjectType)
21-
{
22-
returnobjectType.HasAttr("__iter__");
23-
}
24-
25-
publicboolCanDecode(PyTypeobjectType,TypetargetType)
26-
{
27-
returnIsIterable(objectType)&&IsIterable(targetType);
28-
}
29-
30-
publicboolTryDecode<T>(PyObjectpyObj,outTvalue)
31-
{
32-
//first see if T is a plan IEnumerable
33-
if(typeof(T)==typeof(System.Collections.IEnumerable))
34-
{
35-
objectenumerable=newCollectionWrappers.IterableWrapper<object>(pyObj);
36-
value=(T)enumerable;
37-
returntrue;
38-
}
39-
40-
varelementType=typeof(T).GetGenericArguments()[0];
41-
varcollectionType=typeof(CollectionWrappers.IterableWrapper<>).MakeGenericType(elementType);
42-
43-
varinstance=Activator.CreateInstance(collectionType,new[]{pyObj});
44-
value=(T)instance;
45-
returntrue;
46-
}
47-
48-
publicstaticIterableDecoderInstance{get;}=newIterableDecoder();
49-
50-
publicstaticvoidRegister()
51-
{
52-
PyObjectConversions.RegisterDecoder(Instance);
53-
}
54-
}
55-
}
1+
usingSystem;
2+
usingSystem.Collections.Generic;
3+
4+
namespacePython.Runtime.Codecs
5+
{
6+
publicclassIterableDecoder:IPyObjectDecoder
7+
{
8+
internalstaticboolIsIterable(TypetargetType)
9+
{
10+
//if it is a plain IEnumerable, we can decode it using sequence protocol.
11+
if(targetType==typeof(System.Collections.IEnumerable))
12+
returntrue;
13+
14+
if(!targetType.IsGenericType)
15+
returnfalse;
16+
17+
returntargetType.GetGenericTypeDefinition()==typeof(IEnumerable<>);
18+
}
19+
20+
internalstaticboolIsIterable(PyTypeobjectType)
21+
{
22+
returnobjectType.HasAttr("__iter__");
23+
}
24+
25+
publicboolCanDecode(PyTypeobjectType,TypetargetType)
26+
{
27+
returnIsIterable(objectType)&&IsIterable(targetType);
28+
}
29+
30+
publicboolTryDecode<T>(PyObjectpyObj,outTvalue)
31+
{
32+
//first see if T is a plan IEnumerable
33+
if(typeof(T)==typeof(System.Collections.IEnumerable))
34+
{
35+
objectenumerable=newCollectionWrappers.IterableWrapper<object>(pyObj);
36+
value=(T)enumerable;
37+
returntrue;
38+
}
39+
40+
varelementType=typeof(T).GetGenericArguments()[0];
41+
varcollectionType=typeof(CollectionWrappers.IterableWrapper<>).MakeGenericType(elementType);
42+
43+
varinstance=Activator.CreateInstance(collectionType,new[]{pyObj});
44+
value=(T)instance;
45+
returntrue;
46+
}
47+
48+
publicstaticIterableDecoderInstance{get;}=newIterableDecoder();
49+
50+
publicstaticvoidRegister()
51+
{
52+
PyObjectConversions.RegisterDecoder(Instance);
53+
}
54+
}
55+
}

‎src/runtime/Codecs/ListDecoder.cs‎

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
usingSystem;
2-
usingSystem.Collections.Generic;
3-
4-
namespacePython.Runtime.Codecs
5-
{
6-
publicclassListDecoder:IPyObjectDecoder
7-
{
8-
privatestaticboolIsList(TypetargetType)
9-
{
10-
if(!targetType.IsGenericType)
11-
returnfalse;
12-
13-
returntargetType.GetGenericTypeDefinition()==typeof(IList<>);
14-
}
15-
16-
privatestaticboolIsList(PyTypeobjectType)
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-
returnPythonReferenceComparer.Instance.Equals(objectType,Runtime.PyListType);
24-
}
25-
26-
publicboolCanDecode(PyTypeobjectType,TypetargetType)
27-
{
28-
returnIsList(objectType)&&IsList(targetType);
29-
}
30-
31-
publicboolTryDecode<T>(PyObjectpyObj,outTvalue)
32-
{
33-
if(pyObj==null)thrownewArgumentNullException(nameof(pyObj));
34-
35-
varelementType=typeof(T).GetGenericArguments()[0];
36-
TypecollectionType=typeof(CollectionWrappers.ListWrapper<>).MakeGenericType(elementType);
37-
38-
varinstance=Activator.CreateInstance(collectionType,new[]{pyObj});
39-
value=(T)instance;
40-
returntrue;
41-
}
42-
43-
publicstaticListDecoderInstance{get;}=newListDecoder();
44-
45-
publicstaticvoidRegister()
46-
{
47-
PyObjectConversions.RegisterDecoder(Instance);
48-
}
49-
}
50-
}
1+
usingSystem;
2+
usingSystem.Collections.Generic;
3+
4+
namespacePython.Runtime.Codecs
5+
{
6+
publicclassListDecoder:IPyObjectDecoder
7+
{
8+
privatestaticboolIsList(TypetargetType)
9+
{
10+
if(!targetType.IsGenericType)
11+
returnfalse;
12+
13+
returntargetType.GetGenericTypeDefinition()==typeof(IList<>);
14+
}
15+
16+
privatestaticboolIsList(PyTypeobjectType)
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+
returnPythonReferenceComparer.Instance.Equals(objectType,Runtime.PyListType);
24+
}
25+
26+
publicboolCanDecode(PyTypeobjectType,TypetargetType)
27+
{
28+
returnIsList(objectType)&&IsList(targetType);
29+
}
30+
31+
publicboolTryDecode<T>(PyObjectpyObj,outTvalue)
32+
{
33+
if(pyObj==null)thrownewArgumentNullException(nameof(pyObj));
34+
35+
varelementType=typeof(T).GetGenericArguments()[0];
36+
TypecollectionType=typeof(CollectionWrappers.ListWrapper<>).MakeGenericType(elementType);
37+
38+
varinstance=Activator.CreateInstance(collectionType,new[]{pyObj});
39+
value=(T)instance;
40+
returntrue;
41+
}
42+
43+
publicstaticListDecoderInstance{get;}=newListDecoder();
44+
45+
publicstaticvoidRegister()
46+
{
47+
PyObjectConversions.RegisterDecoder(Instance);
48+
}
49+
}
50+
}
Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
usingSystem;
2-
usingSystem.Collections.Generic;
3-
4-
namespacePython.Runtime.Codecs
5-
{
6-
publicclassSequenceDecoder:IPyObjectDecoder
7-
{
8-
internalstaticboolIsSequence(TypetargetType)
9-
{
10-
if(!targetType.IsGenericType)
11-
returnfalse;
12-
13-
returntargetType.GetGenericTypeDefinition()==typeof(ICollection<>);
14-
}
15-
16-
internalstaticboolIsSequence(PyTypeobjectType)
17-
{
18-
//must implement iterable protocol to fully implement sequence protocol
19-
if(!IterableDecoder.IsIterable(objectType))returnfalse;
20-
1+
usingSystem;
2+
usingSystem.Collections.Generic;
3+
4+
namespacePython.Runtime.Codecs
5+
{
6+
publicclassSequenceDecoder:IPyObjectDecoder
7+
{
8+
internalstaticboolIsSequence(TypetargetType)
9+
{
10+
if(!targetType.IsGenericType)
11+
returnfalse;
12+
13+
returntargetType.GetGenericTypeDefinition()==typeof(ICollection<>);
14+
}
15+
16+
internalstaticboolIsSequence(PyTypeobjectType)
17+
{
18+
//must implement iterable protocol to fully implement sequence protocol
19+
if(!IterableDecoder.IsIterable(objectType))returnfalse;
20+
2121
//returns wheter it implements the sequence protocol
2222
//according to python doc this needs to exclude dict subclasses
2323
//but I don't know how to look for that given the objectType
2424
//rather than the instance.
25-
returnobjectType.HasAttr("__getitem__");
26-
}
27-
28-
publicboolCanDecode(PyTypeobjectType,TypetargetType)
29-
{
30-
returnIsSequence(objectType)&&IsSequence(targetType);
31-
}
32-
33-
publicboolTryDecode<T>(PyObjectpyObj,outTvalue)
34-
{
35-
if(pyObj==null)thrownewArgumentNullException(nameof(pyObj));
36-
37-
varelementType=typeof(T).GetGenericArguments()[0];
38-
TypecollectionType=typeof(CollectionWrappers.SequenceWrapper<>).MakeGenericType(elementType);
39-
40-
varinstance=Activator.CreateInstance(collectionType,new[]{pyObj});
41-
value=(T)instance;
42-
returntrue;
43-
}
44-
45-
publicstaticSequenceDecoderInstance{get;}=newSequenceDecoder();
46-
47-
publicstaticvoidRegister()
48-
{
49-
PyObjectConversions.RegisterDecoder(Instance);
50-
}
51-
}
52-
}
25+
returnobjectType.HasAttr("__getitem__");
26+
}
27+
28+
publicboolCanDecode(PyTypeobjectType,TypetargetType)
29+
{
30+
returnIsSequence(objectType)&&IsSequence(targetType);
31+
}
32+
33+
publicboolTryDecode<T>(PyObjectpyObj,outTvalue)
34+
{
35+
if(pyObj==null)thrownewArgumentNullException(nameof(pyObj));
36+
37+
varelementType=typeof(T).GetGenericArguments()[0];
38+
TypecollectionType=typeof(CollectionWrappers.SequenceWrapper<>).MakeGenericType(elementType);
39+
40+
varinstance=Activator.CreateInstance(collectionType,new[]{pyObj});
41+
value=(T)instance;
42+
returntrue;
43+
}
44+
45+
publicstaticSequenceDecoderInstance{get;}=newSequenceDecoder();
46+
47+
publicstaticvoidRegister()
48+
{
49+
PyObjectConversions.RegisterDecoder(Instance);
50+
}
51+
}
52+
}

‎src/runtime/Types/ManagedTypes.cd‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<ClassDiagramMajorVersion="1"MinorVersion="1">
33
<ClassName="Python.Runtime.ClassBase"Collapsed="true">
44
<PositionX="15"Y="1.75"Width="1.5" />

‎tests/domain_tests/App.config‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<configuration>
33
<startup>
44
<supportedRuntimeversion="v4.0"sku=".NETFramework,Version=v4.7.2" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp