@@ -34,14 +34,14 @@ def maybe_string(ptr):
3434 if not ptr :
3535 return None
3636
37- return ffi .string (ptr ).decode (" utf8" , errors = " surrogateescape" )
37+ return ffi .string (ptr ).decode (' utf8' , errors = ' surrogateescape' )
3838
3939
40- def to_bytes (s , encoding = " utf-8" , errors = " strict" ):
40+ def to_bytes (s , encoding = ' utf-8' , errors = ' strict' ):
4141 if s == ffi .NULL or s is None :
4242 return ffi .NULL
4343
44- if hasattr (s , " __fspath__" ):
44+ if hasattr (s , ' __fspath__' ):
4545 s = os .fspath (s )
4646
4747 if isinstance (s , bytes ):
@@ -51,7 +51,7 @@ def to_bytes(s, encoding="utf-8", errors="strict"):
5151
5252
5353def to_str (s ):
54- if hasattr (s , " __fspath__" ):
54+ if hasattr (s , ' __fspath__' ):
5555 s = os .fspath (s )
5656
5757 if type (s ) is str :
@@ -69,13 +69,13 @@ def ptr_to_bytes(ptr_cdata):
6969 to a byte buffer containing the address that the pointer refers to.
7070 """
7171
72- pp = ffi .new (" void **" , ptr_cdata )
72+ pp = ffi .new (' void **' , ptr_cdata )
7373 return bytes (ffi .buffer (pp )[:])
7474
7575
7676@contextlib .contextmanager
7777def new_git_strarray ():
78- strarray = ffi .new (" git_strarray *" )
78+ strarray = ffi .new (' git_strarray *' )
7979 yield strarray
8080 C .git_strarray_dispose (strarray )
8181
@@ -88,7 +88,7 @@ def strarray_to_strings(arr):
8888 calling this function.
8989 """
9090 try :
91- return [ffi .string (arr .strings [i ]).decode (" utf-8" ) for i in range (arr .count )]
91+ return [ffi .string (arr .strings [i ]).decode (' utf-8' ) for i in range (arr .count )]
9292 finally :
9393 C .git_strarray_dispose (arr )
9494
@@ -120,19 +120,19 @@ def __init__(self, l):
120120 return
121121
122122 if not isinstance (l , (list , tuple )):
123- raise TypeError (" Value must be a list" )
123+ raise TypeError (' Value must be a list' )
124124
125125 strings = [None ] * len (l )
126126 for i in range (len (l )):
127127 li = l [i ]
128- if not isinstance (li , str ) and not hasattr (li , " __fspath__" ):
129- raise TypeError (" Value must be a string or PathLike object" )
128+ if not isinstance (li , str ) and not hasattr (li , ' __fspath__' ):
129+ raise TypeError (' Value must be a string or PathLike object' )
130130
131- strings [i ] = ffi .new (" char []" , to_bytes (li ))
131+ strings [i ] = ffi .new (' char []' , to_bytes (li ))
132132
133- self .__arr = ffi .new (" char *[]" , strings )
133+ self .__arr = ffi .new (' char *[]' , strings )
134134 self .__strings = strings
135- self .__array = ffi .new (" git_strarray *" , [self .__arr , len (strings )])
135+ self .__array = ffi .new (' git_strarray *' , [self .__arr , len (strings )])
136136
137137 def __enter__ (self ):
138138 return self
0 commit comments