This repository was archived by the owner on Jun 10, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 32
Add basic stubs for some class attributes #9
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d9063b9
Add some typehints
alanhdu f6efbfd
Add ctypes typehints
alanhdu cf16064
Add stubs for dtype
alanhdu b814fac
Setup Travis and correct setup.py (#8)
59bd6bc
Fix some type annotations
alanhdu 5bffb72
Make attributes read-only properties
alanhdu eac85ff
Add metadata property
alanhdu d6c586c
Move flags into flagobj
alanhdu 3cc8475
Add _Shape type alias
alanhdu c84c9bc
Alphabetize properties
alanhdu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add ctypes typehints
- Loading branch information
commit f6efbfdffd871959116a70f625ca5b25052f2e53
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
# | ||
from typing import Any, Tuple, Optional | ||
|
||
from numpy.core._internal import _ctypes | ||
|
||
class dtype: pass | ||
_dtype = dtype # for ndarray type | ||
|
||
|
@@ -51,7 +53,7 @@ class ndarray: | |
ndim: int | ||
shape: Tuple[int, ...] | ||
strides: Tuple[int, ...] | ||
ctypes: Any | ||
ctypes: _ctypes | ||
base: Optional[ndarray] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This list is incomplete for now, so let's add |
||
|
||
|
Empty file.
This file contains hidden or 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,21 @@ | ||
from typing import Any | ||
|
||
# TODO: add better annotations when ctypes is stubbed out | ||
|
||
class _ctypes: | ||
@property | ||
def data(self) -> int: ... | ||
|
||
@property | ||
def shape(self) -> Any: ... | ||
|
||
@property | ||
def strides(self) -> Any: ... | ||
|
||
def data_as(self, obj: Any) -> Any: ... | ||
def shape_as(self, obj: Any) -> Any: ... | ||
def strides_as(self, obj: Any) -> Any: ... | ||
def get_data(self) -> int: ... | ||
def get_shape(self) -> Any: ... | ||
def get_strides(self) -> Any: ... | ||
def get_as_parameter(self) -> Any: ... |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give this a name like
_dtype_class
to make it a little clearer what it is?