|
6 | 6 | """Module containing module parser implementation able to properly read and write
|
7 | 7 | configuration files"""
|
8 | 8 |
|
| 9 | +importsys |
9 | 10 | importabc
|
10 | 11 | fromfunctoolsimportwraps
|
11 | 12 | importinspect
|
|
33 | 34 | fromtypingimport (Any,Callable,Generic,IO,List,Dict,Sequence,
|
34 | 35 | TYPE_CHECKING,Tuple,TypeVar,Union,cast,overload)
|
35 | 36 |
|
36 |
| -fromgit.typesimportLit_config_levels,ConfigLevels_Tup,OrderedDict,PathLike,TBD,assert_never,_T |
| 37 | +fromgit.typesimportLit_config_levels,ConfigLevels_Tup,PathLike,TBD,assert_never,_T |
37 | 38 |
|
38 | 39 | ifTYPE_CHECKING:
|
39 | 40 | fromgit.repo.baseimportRepo
|
40 | 41 | fromioimportBytesIO
|
41 | 42 |
|
42 | 43 | T_ConfigParser=TypeVar('T_ConfigParser',bound='GitConfigParser')
|
| 44 | + |
| 45 | +ifsys.version_info[:2]< (3,7): |
| 46 | +fromcollectionsimportOrderedDict |
| 47 | +OrderedDict_OMD=OrderedDict |
| 48 | +else: |
| 49 | +fromtypingimportOrderedDict |
| 50 | +OrderedDict_OMD=OrderedDict[str,List[_T]] |
| 51 | + |
43 | 52 | # -------------------------------------------------------------
|
44 | 53 |
|
45 | 54 | __all__= ('GitConfigParser','SectionConstraint')
|
@@ -164,7 +173,7 @@ def __exit__(self, exception_type: str, exception_value: str, traceback: str) ->
|
164 | 173 | self._config.__exit__(exception_type,exception_value,traceback)
|
165 | 174 |
|
166 | 175 |
|
167 |
| -class_OMD(OrderedDict[str,List[_T]]): |
| 176 | +class_OMD(OrderedDict_OMD): |
168 | 177 | """Ordered multi-dict."""
|
169 | 178 |
|
170 | 179 | def__setitem__(self,key:str,value:_T)->None:# type: ignore[override]
|
@@ -617,6 +626,7 @@ def write_section(name, section_dict):
|
617 | 626 |
|
618 | 627 | ifself._defaults:
|
619 | 628 | write_section(cp.DEFAULTSECT,self._defaults)
|
| 629 | +value:TBD |
620 | 630 | forname,valueinself._sections.items():
|
621 | 631 | write_section(name,value)
|
622 | 632 |
|
|