-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from atifaziz/rm/PyKeyValuePairEnumerable
Reuse `PyEnumerable`, removing need for `PyKeyValuePairEnumerable`
- Loading branch information
Showing
4 changed files
with
31 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using CSnakes.Runtime.Python; | ||
|
||
internal interface IPyObjectImporter<out T> | ||
{ | ||
static abstract T Import(PyObject pyObj); | ||
} | ||
|
||
internal sealed class PyObjectImporter<T> : | ||
IPyObjectImporter<T> | ||
{ | ||
private PyObjectImporter() { } | ||
|
||
public static T Import(PyObject pyObj) => pyObj.As<T>(); | ||
} | ||
|
||
internal sealed class PyObjectImporter<TKey, TValue> : | ||
IPyObjectImporter<KeyValuePair<TKey, TValue>> | ||
{ | ||
private PyObjectImporter() { } | ||
|
||
public static KeyValuePair<TKey, TValue> Import(PyObject pyObj) => pyObj.As<TKey, TValue>(); | ||
} |