Skip to content

Commit e3114b2

Browse files
author
Justine Wezenaar
committed
add links to mypy issues
1 parent 7888212 commit e3114b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Pandas Copilot Instructions
1+
# pandas Copilot Instructions
22

33
## Project Overview
44
`pandas` is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
@@ -13,7 +13,7 @@ pandas strongly encourages the use of PEP 484 style type hints. New development
1313

1414
Type imports should follow the from `typing import ...` convention. Your code may be automatically re-written to use some modern constructs (e.g. using the built-in `list` instead of `typing.List`) by the pre-commit checks.
1515

16-
In some cases in the code base classes may define class variables that shadow builtins. This causes an issue as described in Mypy 1775. The defensive solution here is to create an unambiguous alias of the builtin and use that without your annotation. For example, if you come across a definition like
16+
In some cases in the code base classes may define class variables that shadow builtins. This causes an issue as described in [Mypy 1775](https://github.com/python/mypy/issues/1775#issuecomment-310969854). The defensive solution here is to create an unambiguous alias of the builtin and use that without your annotation. For example, if you come across a definition like
1717

1818
```
1919
class SomeClass1:
@@ -43,7 +43,7 @@ def cannot_infer_bad(obj: Union[str, int, float]):
4343
obj = cast(str, obj) # Mypy complains without this!
4444
return obj.upper()
4545
```
46-
The limitation here is that while a human can reasonably understand that `is_number` would catch the `int` and `float` types mypy cannot make that same inference just yet (see mypy #5206. While the above works, the use of `cast` is strongly discouraged. Where applicable a refactor of the code to appease static analysis is preferable.)
46+
The limitation here is that while a human can reasonably understand that `is_number` would catch the `int` and `float` types mypy cannot make that same inference just yet (see [mypy #5206](https://github.com/python/mypy/issues/5206). While the above works, the use of `cast` is **strongly discouraged**. Where applicable a refactor of the code to appease static analysis is preferable.)
4747

4848
```
4949
def cannot_infer_good(obj: Union[str, int, float]):

0 commit comments

Comments
 (0)