Skip to content

Commit e4de782

Browse files
committed
Port stuff over to Napoleon
1 parent 2b8f152 commit e4de782

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

libvcs/git.py

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
def extract_status(value):
4444
"""Returns ``git status -sb --porcelain=2`` extracted to a dict
4545
46-
:returns: Dictionary of git repo's status
47-
:rtype: dict
46+
Returns
47+
-------
48+
dict :
49+
Dictionary of git repo's status
4850
"""
4951
pattern = re.compile(
5052
r"""[\n\r]?
@@ -360,7 +362,9 @@ def remotes(self, flat=False):
360362
This used to return a dict of tuples, it now returns a dict of dictionaries
361363
with ``name``, ``fetch_url``, and ``push_url``.
362364
363-
:rtype: dict
365+
Returns
366+
-------
367+
dict
364368
"""
365369
remotes = {}
366370

@@ -393,10 +397,15 @@ def remotes_get(self):
393397
def remote(self, name, **kwargs):
394398
"""Get the fetch and push URL for a specified remote name.
395399
396-
:param name: the remote name used to define the fetch and push URL
397-
:type name: str
398-
:returns: remote name and url in tuple form
399-
:rtype: :class:`libvcs.git.GitRemote`
400+
Parameters
401+
----------
402+
name : str
403+
The remote name used to define the fetch and push URL
404+
405+
Returns
406+
-------
407+
:class:`libvcs.git.GitRemote` :
408+
Remote name and url in tuple form
400409
401410
.. versionchanged:: 0.4.0
402411
@@ -482,11 +491,15 @@ def remote_set(self, url, name='origin', overwrite=False, **kwargs):
482491
def chomp_protocol(url):
483492
"""Return clean VCS url from RFC-style url
484493
485-
:param url: url
486-
:type url: str
487-
:rtype: str
488-
:returns: url as VCS software would accept it
489-
:seealso: #14
494+
Parameters
495+
----------
496+
url : str
497+
PIP-style url
498+
499+
Returns
500+
-------
501+
str :
502+
URL as VCS software would accept it
490503
"""
491504
if '+' in url:
492505
url = url.split('+', 1)[1]
@@ -506,7 +519,9 @@ def chomp_protocol(url):
506519
def get_git_version(self):
507520
"""Return current version of git binary
508521
509-
:rtype: str
522+
Returns
523+
-------
524+
str
510525
"""
511526
VERSION_PFX = 'git version '
512527
version = self.run(['version'])
@@ -521,7 +536,10 @@ def status(self):
521536
522537
Wraps ``git status --sb --porcelain=2``. Does not include changed files, yet.
523538
524-
.. code-block:: python
539+
Examples
540+
--------
541+
542+
::
525543
526544
print(git_repo.status())
527545
{
@@ -533,15 +551,21 @@ def status(self):
533551
"branch_behind": '0',
534552
}
535553
536-
:returns: Status of current checked out repository
537-
:rtype: dict
554+
Returns
555+
-------
556+
dict :
557+
Status of current checked out repository
538558
"""
539559
return extract_status(self.run(['status', '-sb', '--porcelain=2']))
540560

541561
def get_current_remote_name(self):
542562
"""Retrieve name of the remote / upstream of currently checked out branch.
543563
544-
:rtype: str, None if no remote set
564+
Returns
565+
-------
566+
str :
567+
If upstream the same, returns ``branch_name``.
568+
If upstream mismatches, returns ``remote_name/branch_name``.
545569
"""
546570
match = self.status()
547571

0 commit comments

Comments
 (0)