__getattr__¶
-
_AsyncGit.__getattr__(item: str) → Union[Callable[[Any, Any, Any, Any, Any], Coroutine], callable, Any][source]¶ If an attribute doesn’t exist, this method will return a
awaitable()function that simply callsgit()with the attribute name as the first argument, followed by any additional positional/keyword arguments.Since a lot of git commands have
-in their name, but Python doesn’t support attributes containing-, non-existent attributes will have_replaced with-when callinggit()with their name.For example,
git.count_objects('-v')would becomegit count-objects -vThis allows most unimplemented
gitsub-commands to function when called as a method, for example, at the current point in time, neither thedescribecommand, norcount-objectsare implemented as a method, but both can still be called synchronously or asynchronously and it will work:>>> from privex.helpers import Git >>> g = Git() >>> g.describe('--tags') '2.14.0-1-g8418c96' >>> await g.describe('--tags') '2.14.0-1-g8418c96' >>> g.count_objects() '2061 objects, 8880 kilobytes' >>> await g.count_objects() '2061 objects, 8880 kilobytes'