@@ -354,21 +354,19 @@ def __ne__(self, rhs: object) -> bool:
354
354
def __hash__ (self ) -> int :
355
355
return hash (self .git_dir )
356
356
357
- # Description property
358
- def _get_description (self ) -> str :
357
+ @property
358
+ def description (self ) -> str :
359
+ """The project's description"""
359
360
filename = osp .join (self .git_dir , "description" )
360
361
with open (filename , "rb" ) as fp :
361
362
return fp .read ().rstrip ().decode (defenc )
362
363
363
- def _set_description (self , descr : str ) -> None :
364
+ @description .setter
365
+ def description (self , descr : str ) -> None :
364
366
filename = osp .join (self .git_dir , "description" )
365
367
with open (filename , "wb" ) as fp :
366
368
fp .write ((descr + "\n " ).encode (defenc ))
367
369
368
- description = property (_get_description , _set_description , doc = "the project's description" )
369
- del _get_description
370
- del _set_description
371
-
372
370
@property
373
371
def working_tree_dir (self ) -> Optional [PathLike ]:
374
372
"""
@@ -885,13 +883,14 @@ def _set_daemon_export(self, value: object) -> None:
885
883
elif not value and fileexists :
886
884
os .unlink (filename )
887
885
888
- daemon_export = property (
889
- _get_daemon_export ,
890
- _set_daemon_export ,
891
- doc = "If True, git-daemon may export this repository" ,
892
- )
893
- del _get_daemon_export
894
- del _set_daemon_export
886
+ @property
887
+ def daemon_export (self ) -> bool :
888
+ """If True, git-daemon may export this repository"""
889
+ return self ._get_daemon_export ()
890
+
891
+ @daemon_export .setter
892
+ def daemon_export (self , value : object ) -> None :
893
+ self ._set_daemon_export (value )
895
894
896
895
def _get_alternates (self ) -> List [str ]:
897
896
"""The list of alternates for this repo from which objects can be retrieved.
@@ -929,11 +928,14 @@ def _set_alternates(self, alts: List[str]) -> None:
929
928
with open (alternates_path , "wb" ) as f :
930
929
f .write ("\n " .join (alts ).encode (defenc ))
931
930
932
- alternates = property (
933
- _get_alternates ,
934
- _set_alternates ,
935
- doc = "Retrieve a list of alternates paths or set a list paths to be used as alternates" ,
936
- )
931
+ @property
932
+ def alternates (self ) -> List [str ]:
933
+ """Retrieve a list of alternates paths or set a list paths to be used as alternates"""
934
+ return self ._get_alternates ()
935
+
936
+ @alternates .setter
937
+ def alternates (self , alts : List [str ]) -> None :
938
+ self ._set_alternates (alts )
937
939
938
940
def is_dirty (
939
941
self ,
0 commit comments