11# -*- coding: utf-8 -*-
22
3- import sys
43from os import PathLike
54from pathlib import Path
65
@@ -25,7 +24,7 @@ class Repository(_Repository):
2524 Apache License, Version 2.0
2625 """
2726
28- def __init__ (self , git_directory = "." , logger = None , ** kwargs ):
27+ def __init__ (self , git_directory : str | PathLike [ str ] = "." , logger = None , ** kwargs ):
2928 """
3029 Constructor __init__(Repository)
3130
@@ -38,8 +37,7 @@ def __init__(self, git_directory=".", logger=None, **kwargs):
3837 if logger is None or not logger .hasHandlers ():
3938 logger = LoggerSetup .get_logger ("gardenlinux.git" )
4039
41- if not isinstance (git_directory , PathLike ):
42- git_directory = Path (git_directory )
40+ git_directory = Path (git_directory )
4341
4442 if not git_directory .exists ():
4543 raise RuntimeError (f"Git directory given is invalid: { git_directory } " )
@@ -107,11 +105,11 @@ def root_repo(self):
107105
108106 @staticmethod
109107 def checkout_repo (
110- git_directory ,
108+ git_directory : str | PathLike [ str ] ,
111109 repo_url = GL_REPOSITORY_URL ,
112- branch = "main" ,
113- commit = None ,
114- pathspecs = None ,
110+ branch : str = "main" ,
111+ commit : str | None = None ,
112+ pathspecs : list [ str ] | None = None ,
115113 logger = None ,
116114 ** kwargs ,
117115 ):
@@ -122,8 +120,7 @@ def checkout_repo(
122120 :since: 0.10.0
123121 """
124122
125- if not isinstance (git_directory , PathLike ):
126- git_directory = Path (git_directory )
123+ git_directory = Path (git_directory )
127124
128125 if not git_directory .is_dir () or git_directory .match ("/*" ):
129126 raise RuntimeError (
0 commit comments