Show More
@@ -7,6 +7,13 b'' | |||||
7 | # This software may be used and distributed according to the terms of the |
|
7 | # This software may be used and distributed according to the terms of the | |
8 | # GNU General Public License version 2 or any later version. |
|
8 | # GNU General Public License version 2 or any later version. | |
9 |
|
9 | |||
|
10 | import typing | |||
|
11 | ||||
|
12 | from typing import ( | |||
|
13 | Any, | |||
|
14 | Dict, | |||
|
15 | Optional, | |||
|
16 | ) | |||
10 |
|
17 | |||
11 | from .i18n import _ |
|
18 | from .i18n import _ | |
12 |
|
19 | |||
@@ -15,10 +22,20 b' from . import (' | |||||
15 | pycompat, |
|
22 | pycompat, | |
16 | ) |
|
23 | ) | |
17 |
|
24 | |||
|
25 | if typing.TYPE_CHECKING: | |||
|
26 | from . import ui as uimod | |||
|
27 | ||||
|
28 | # TODO: narrow the value after the config module is typed | |||
|
29 | _Opts = Dict[bytes, Any] | |||
|
30 | ||||
18 |
|
31 | |||
19 | def diffallopts( |
|
32 | def diffallopts( | |
20 | ui, opts=None, untrusted=False, section=b'diff', configprefix=b'' |
|
33 | ui: "uimod.ui", | |
21 | ): |
|
34 | opts: Optional[_Opts] = None, | |
|
35 | untrusted: bool = False, | |||
|
36 | section: bytes = b'diff', | |||
|
37 | configprefix: bytes = b'', | |||
|
38 | ) -> mdiff.diffopts: | |||
22 | '''return diffopts with all features supported and parsed''' |
|
39 | '''return diffopts with all features supported and parsed''' | |
23 | return difffeatureopts( |
|
40 | return difffeatureopts( | |
24 | ui, |
|
41 | ui, | |
@@ -33,15 +50,15 b' def diffallopts(' | |||||
33 |
|
50 | |||
34 |
|
51 | |||
35 | def difffeatureopts( |
|
52 | def difffeatureopts( | |
36 | ui, |
|
53 | ui: "uimod.ui", | |
37 | opts=None, |
|
54 | opts: Optional[_Opts] = None, | |
38 | untrusted=False, |
|
55 | untrusted: bool = False, | |
39 | section=b'diff', |
|
56 | section: bytes = b'diff', | |
40 | git=False, |
|
57 | git: bool = False, | |
41 | whitespace=False, |
|
58 | whitespace: bool = False, | |
42 | formatchanging=False, |
|
59 | formatchanging: bool = False, | |
43 | configprefix=b'', |
|
60 | configprefix: bytes = b'', | |
44 | ): |
|
61 | ) -> mdiff.diffopts: | |
45 | """return diffopts with only opted-in features parsed |
|
62 | """return diffopts with only opted-in features parsed | |
46 |
|
63 | |||
47 | Features: |
|
64 | Features: | |
@@ -51,7 +68,12 b' def difffeatureopts(' | |||||
51 | with most diff parsers |
|
68 | with most diff parsers | |
52 | """ |
|
69 | """ | |
53 |
|
70 | |||
54 | def get(key, name=None, getter=ui.configbool, forceplain=None): |
|
71 | def get( | |
|
72 | key: bytes, | |||
|
73 | name: Optional[bytes] = None, | |||
|
74 | getter=ui.configbool, | |||
|
75 | forceplain: Optional[bool] = None, | |||
|
76 | ) -> Any: | |||
55 | if opts: |
|
77 | if opts: | |
56 | v = opts.get(key) |
|
78 | v = opts.get(key) | |
57 | # diffopts flags are either None-default (which is passed |
|
79 | # diffopts flags are either None-default (which is passed |
General Comments 0
You need to be logged in to leave comments.
Login now