Skip to content

Commit

Permalink
fix docs for dota2.util
Browse files Browse the repository at this point in the history
  • Loading branch information
rossengeorgiev committed Dec 16, 2017
1 parent 55a5613 commit 29b1ad1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/dota2.util.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
util
===
====

.. automodule:: dota2.util
:members:
28 changes: 14 additions & 14 deletions dota2/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ def replay_url(match_id, cluster, replay_salt, app_id=570):
"""Form url for match replay
:param match_id: match id
:type match_id: :class: `int`
:type match_id: :class:`int`
:param cluster: cluster the match is saved on
:type cluster: :class: `int`
:type cluster: :class:`int`
:param replay_salt: salt linked to the replay
:type replay_salt: :class: `int`
:type replay_salt: :class:`int`
:param app_id: (optional) app_id for dota
:type app_id: :class: `int`
:type app_id: :class:`int`
:return: url to download the replay of a specific match
:rtype: :class: `str`
:rtype: :class:`str`
"""
return 'http://replay{0}.valve.net/{1}/{2}_{3}.dem.bz2'.format(cluster, app_id, match_id, replay_salt)

Expand All @@ -22,9 +22,9 @@ def replay_url_from_match(match, app_id=570):
:param match: `CMsgDOTAMatch <https://github.com/ValvePython/dota2/blob/e06c81c03579a912fcca829766ee590075ae97dc/protobufs/dota_gcmessages_common.proto#L866-L1001>`_
:type match: proto message
:param app_id: (optional) app_id for dota
:type app_id: :class: `int`
:type app_id: :class:`int`
:return: url to download the replay of a specific match, None if match has not all the information
:rtype: :class: `str`, :class:`None`
:rtype: :class:`str`, :class:`None`
"""
if match.HasField('match_id') and match.HasField('cluster') and match.HasField('replay_salt'):
return replay_url(match.match_id, match.cluster, match.replay_salt, app_id)
Expand All @@ -34,15 +34,15 @@ def metadata_url(match_id, cluster, replay_salt, app_id=570):
"""Form url for match metadata file
:param match_id: match id
:type match_id: :class: `int`
:type match_id: :class:`int`
:param cluster: cluster the match is saved on
:type cluster: :class: `int`
:type cluster: :class:`int`
:param replay_salt: salt linked to the replay
:type replay_salt: :class: `int`
:type replay_salt: :class:`int`
:param app_id: (optional) app_id for dota
:type app_id: :class: `int`
:type app_id: :class:`int`
:return: url to download the metadata of a specific match
:rtype: :class: `str`
:rtype: :class:`str`
"""
return 'http://replay{0}.valve.net/{1}/{2}_{3}.meta.bz2'.format(cluster, app_id, match_id, replay_salt)

Expand All @@ -53,9 +53,9 @@ def metadata_url_from_match(match, app_id=570):
:param match: `CMsgDOTAMatch <https://github.com/ValvePython/dota2/blob/e06c81c03579a912fcca829766ee590075ae97dc/protobufs/dota_gcmessages_common.proto#L866-L1001>`_
:type match: proto message
:param app_id: (optional) app_id for dota
:type app_id: :class: `int`
:type app_id: :class:`int`
:return: url to download the metadata of a specific match, None if match has not all the information
:rtype: :class: `str`, :class:`None`
:rtype: :class:`str`, :class:`None`
"""
if match.HasField('match_id') and match.HasField('cluster') and match.HasField('replay_salt'):
return metadata_url(match.match_id, match.cluster, match.replay_salt, app_id)

0 comments on commit 29b1ad1

Please sign in to comment.