Show More
@@ -29,7 +29,7 b' jobs:' | |||||
29 | run: | |
|
29 | run: | | |
30 | python -m pip install --upgrade pip |
|
30 | python -m pip install --upgrade pip | |
31 | # when changing the versions please update CONTRIBUTING.md too |
|
31 | # when changing the versions please update CONTRIBUTING.md too | |
32 |
pip install --only-binary ':all:' darker== |
|
32 | pip install --only-binary ':all:' darker==2.1.1 black==24.10.0 | |
33 | - name: Lint with darker |
|
33 | - name: Lint with darker | |
34 | run: | |
|
34 | run: | | |
35 | darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || ( |
|
35 | darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || ( |
@@ -1362,9 +1362,9 b' def match_dict_keys(' | |||||
1362 | # All checks passed! |
|
1362 | # All checks passed! | |
1363 | return True |
|
1363 | return True | |
1364 |
|
1364 | |||
1365 | filtered_key_is_final: Dict[ |
|
1365 | filtered_key_is_final: Dict[Union[str, bytes, int, float], _DictKeyState] = ( | |
1366 | Union[str, bytes, int, float], _DictKeyState |
|
1366 | defaultdict(lambda: _DictKeyState.BASELINE) | |
1367 | ] = defaultdict(lambda: _DictKeyState.BASELINE) |
|
1367 | ) | |
1368 |
|
1368 | |||
1369 | for k in keys: |
|
1369 | for k in keys: | |
1370 | # If at least one of the matches is not final, mark as undetermined. |
|
1370 | # If at least one of the matches is not final, mark as undetermined. |
@@ -44,20 +44,17 b' else:' | |||||
44 |
|
44 | |||
45 | @undoc |
|
45 | @undoc | |
46 | class HasGetItem(Protocol): |
|
46 | class HasGetItem(Protocol): | |
47 | def __getitem__(self, key) -> None: |
|
47 | def __getitem__(self, key) -> None: ... | |
48 | ... |
|
|||
49 |
|
48 | |||
50 |
|
49 | |||
51 | @undoc |
|
50 | @undoc | |
52 | class InstancesHaveGetItem(Protocol): |
|
51 | class InstancesHaveGetItem(Protocol): | |
53 | def __call__(self, *args, **kwargs) -> HasGetItem: |
|
52 | def __call__(self, *args, **kwargs) -> HasGetItem: ... | |
54 | ... |
|
|||
55 |
|
53 | |||
56 |
|
54 | |||
57 | @undoc |
|
55 | @undoc | |
58 | class HasGetAttr(Protocol): |
|
56 | class HasGetAttr(Protocol): | |
59 | def __getattr__(self, key) -> None: |
|
57 | def __getattr__(self, key) -> None: ... | |
60 | ... |
|
|||
61 |
|
58 | |||
62 |
|
59 | |||
63 | @undoc |
|
60 | @undoc | |
@@ -329,9 +326,9 b' class EvaluationContext(NamedTuple):' | |||||
329 | #: Global namespace |
|
326 | #: Global namespace | |
330 | globals: dict |
|
327 | globals: dict | |
331 | #: Evaluation policy identifier |
|
328 | #: Evaluation policy identifier | |
332 | evaluation: Literal[ |
|
329 | evaluation: Literal["forbidden", "minimal", "limited", "unsafe", "dangerous"] = ( | |
333 | "forbidden", "minimal", "limited", "unsafe", "dangerous" |
|
330 | "forbidden" | |
334 | ] = "forbidden" |
|
331 | ) | |
335 | #: Whether the evaluation of code takes place inside of a subscript. |
|
332 | #: Whether the evaluation of code takes place inside of a subscript. | |
336 | #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``. |
|
333 | #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``. | |
337 | in_subscript: bool = False |
|
334 | in_subscript: bool = False |
@@ -2,9 +2,11 b'' | |||||
2 | """Being removed |
|
2 | """Being removed | |
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
|
5 | ||||
5 | class LazyEvaluate(object): |
|
6 | class LazyEvaluate(object): | |
6 | """This is used for formatting strings with values that need to be updated |
|
7 | """This is used for formatting strings with values that need to be updated | |
7 | at that time, such as the current time or working directory.""" |
|
8 | at that time, such as the current time or working directory.""" | |
|
9 | ||||
8 | def __init__(self, func, *args, **kwargs): |
|
10 | def __init__(self, func, *args, **kwargs): | |
9 | self.func = func |
|
11 | self.func = func | |
10 | self.args = args |
|
12 | self.args = args | |
@@ -16,6 +18,6 b' class LazyEvaluate(object):' | |||||
16 |
|
18 | |||
17 | def __str__(self): |
|
19 | def __str__(self): | |
18 | return str(self()) |
|
20 | return str(self()) | |
19 |
|
21 | |||
20 | def __format__(self, format_spec): |
|
22 | def __format__(self, format_spec): | |
21 | return format(self(), format_spec) |
|
23 | return format(self(), format_spec) |
@@ -1,4 +1,4 b'' | |||||
1 | # coding: iso-8859-5 |
|
1 | # coding: iso-8859-5 | |
2 | # (Unlikely to be the default encoding for most testers.) |
|
2 | # (Unlikely to be the default encoding for most testers.) | |
3 | # БЖџрстуфхцчшщъыьэюя <- Cyrillic characters |
|
3 | # ������������������� <- Cyrillic characters | |
4 | 'Ўт№Ф' |
|
4 | "����" |
@@ -535,8 +535,7 b' def test_custom_repr_namedtuple_partialmethod():' | |||||
535 | from functools import partialmethod |
|
535 | from functools import partialmethod | |
536 | from typing import NamedTuple |
|
536 | from typing import NamedTuple | |
537 |
|
537 | |||
538 | class Foo(NamedTuple): |
|
538 | class Foo(NamedTuple): ... | |
539 | ... |
|
|||
540 |
|
539 | |||
541 | Foo.__repr__ = partialmethod(lambda obj: "Hello World") |
|
540 | Foo.__repr__ = partialmethod(lambda obj: "Hello World") | |
542 | foo = Foo() |
|
541 | foo = Foo() |
@@ -3,9 +3,9 b'' | |||||
3 | Extra capabilities for IPython |
|
3 | Extra capabilities for IPython | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 | #----------------------------------------------------------------------------- |
|
6 | # ----------------------------------------------------------------------------- | |
7 | # Copyright (C) 2008-2011 The IPython Development Team |
|
7 | # Copyright (C) 2008-2011 The IPython Development Team | |
8 | # |
|
8 | # | |
9 | # Distributed under the terms of the BSD License. The full license is in |
|
9 | # Distributed under the terms of the BSD License. The full license is in | |
10 | # the file COPYING, distributed as part of this software. |
|
10 | # the file COPYING, distributed as part of this software. | |
11 | #----------------------------------------------------------------------------- |
|
11 | # ----------------------------------------------------------------------------- |
@@ -1,10 +1,10 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 | __docformat__ = "restructuredtext en" |
|
2 | __docformat__ = "restructuredtext en" | |
3 | #------------------------------------------------------------------------------- |
|
3 | # ------------------------------------------------------------------------------- | |
4 | # Copyright (C) 2005 Fernando Perez <fperez@colorado.edu> |
|
4 | # Copyright (C) 2005 Fernando Perez <fperez@colorado.edu> | |
5 | # Brian E Granger <ellisonbg@gmail.com> |
|
5 | # Brian E Granger <ellisonbg@gmail.com> | |
6 | # Benjamin Ragan-Kelley <benjaminrk@gmail.com> |
|
6 | # Benjamin Ragan-Kelley <benjaminrk@gmail.com> | |
7 | # |
|
7 | # | |
8 | # Distributed under the terms of the BSD License. The full license is in |
|
8 | # Distributed under the terms of the BSD License. The full license is in | |
9 | # the file COPYING, distributed as part of this software. |
|
9 | # the file COPYING, distributed as part of this software. | |
10 | #------------------------------------------------------------------------------- |
|
10 | # ------------------------------------------------------------------------------- |
@@ -35,6 +35,7 b' def system(cmd):' | |||||
35 | # Start up process: |
|
35 | # Start up process: | |
36 | reg = System.Diagnostics.Process.Start(psi) |
|
36 | reg = System.Diagnostics.Process.Start(psi) | |
37 |
|
37 | |||
|
38 | ||||
38 | def getoutput(cmd): |
|
39 | def getoutput(cmd): | |
39 | """ |
|
40 | """ | |
40 | getoutput(cmd) should work in a cli environment on Mac OSX, Linux, |
|
41 | getoutput(cmd) should work in a cli environment on Mac OSX, Linux, | |
@@ -53,6 +54,7 b' def getoutput(cmd):' | |||||
53 | error = myError.ReadToEnd() |
|
54 | error = myError.ReadToEnd() | |
54 | return output |
|
55 | return output | |
55 |
|
56 | |||
|
57 | ||||
56 | def check_pid(pid): |
|
58 | def check_pid(pid): | |
57 | """ |
|
59 | """ | |
58 | Check if a process with the given PID (pid) exists |
|
60 | Check if a process with the given PID (pid) exists | |
@@ -66,4 +68,4 b' def check_pid(pid):' | |||||
66 | return True |
|
68 | return True | |
67 | except System.ArgumentException: |
|
69 | except System.ArgumentException: | |
68 | # process with given pid isn't running |
|
70 | # process with given pid isn't running | |
69 |
return False |
|
71 | return False |
@@ -41,7 +41,7 b' def dir2(obj):' | |||||
41 | # TypeError: dir(obj) does not return a list |
|
41 | # TypeError: dir(obj) does not return a list | |
42 | words = set() |
|
42 | words = set() | |
43 |
|
43 | |||
44 |
if safe_hasattr(obj, |
|
44 | if safe_hasattr(obj, "__class__"): | |
45 | words |= set(dir(obj.__class__)) |
|
45 | words |= set(dir(obj.__class__)) | |
46 |
|
46 | |||
47 | # filter out non-string attributes which may be stuffed by dir() calls |
|
47 | # filter out non-string attributes which may be stuffed by dir() calls | |
@@ -62,7 +62,7 b' def get_real_method(obj, name):' | |||||
62 | Returns the method or None. |
|
62 | Returns the method or None. | |
63 | """ |
|
63 | """ | |
64 | try: |
|
64 | try: | |
65 |
canary = getattr(obj, |
|
65 | canary = getattr(obj, "_ipython_canary_method_should_not_exist_", None) | |
66 | except Exception: |
|
66 | except Exception: | |
67 | return None |
|
67 | return None | |
68 |
|
68 |
General Comments 0
You need to be logged in to leave comments.
Login now