-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor fixes and updates in trait_types.pyi; new ctraits.pyi (#1661)
This PR makes some minor type-stub related fixes and cleanups, as part of an incremental effort to get the stubs into a usable state. * Add suitable flake8 exclusions for type stubs (it's common to put the ... on the same line as a function def, for example; black does that, but flake8 complains about it). * Add new ctraits.pyi type stubs. It's not complete, but it's sufficient to stop complaints in some other parts of the codebase. * Fix confusion with int being both the built-in type and an enum name in ValidateTrait * Several fixes in trait_types.pyi. In particular, Pylance/Pyright doesn't like missing type variables, even though the typing documentation says that it should be okay to use e.g., plain Callable instead of Callable[..., Any]. * Fix some non-standard double indentation in the trait_types.pyi stubs. Co-authored-by: Corran Webster <cwebster@enthought.com> (cherry picked from commit 9f5fe4d)
- Loading branch information
1 parent
beb732b
commit e77baac
Showing
4 changed files
with
196 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
[flake8] | ||
exclude = traits/observation/_generated_parser.py,build | ||
ignore = E266,W503,E722,E731,E741 | ||
per-file-ignores = */api.py:F401 | ||
per-file-ignores = | ||
*/api.py:F401 | ||
# Suppress flake8 complaints about black's formatting of .pyi files | ||
*.pyi:E302,E305,E701,E704 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# (C) Copyright 2020-2022 Enthought, Inc., Austin, TX | ||
# All rights reserved. | ||
# | ||
# This software is provided without warranty under the terms of the BSD | ||
# license included in LICENSE.txt and may be redistributed only under | ||
# the conditions described in the aforementioned license. The license | ||
# is also available online at http://www.enthought.com/licenses/BSD.txt | ||
# | ||
# Thanks for using Enthought open source! | ||
|
||
from typing import Any | ||
|
||
# Constants used in DefaultValue enumeration. | ||
_CALLABLE_AND_ARGS_DEFAULT_VALUE: int | ||
_CALLABLE_DEFAULT_VALUE: int | ||
_CONSTANT_DEFAULT_VALUE: int | ||
_DICT_COPY_DEFAULT_VALUE: int | ||
_DISALLOW_DEFAULT_VALUE: int | ||
_LIST_COPY_DEFAULT_VALUE: int | ||
_MAXIMUM_DEFAULT_VALUE_TYPE: int | ||
_MISSING_DEFAULT_VALUE: int | ||
_OBJECT_DEFAULT_VALUE: int | ||
_TRAIT_DICT_OBJECT_DEFAULT_VALUE: int | ||
_TRAIT_LIST_OBJECT_DEFAULT_VALUE: int | ||
_TRAIT_SET_OBJECT_DEFAULT_VALUE: int | ||
|
||
def _validate_complex_number(value: Any) -> complex: ... | ||
def _validate_float(value: Any) -> float: ... |
Oops, something went wrong.