Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up PEP8 errors and other small error from PR #144 #169

Merged
merged 3 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions matrix_client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def register(self, content={}, kind='user'):
| session (string): The value of the session key given by the
| homeserver.

| type (string): Required. The login type that the client is attempting
| to complete. "m.login.dummy" is the only non-interactive type.
| type (string): Required. The login type that the client is
| attempting to complete. "m.login.dummy" is the only
| non-interactive type.

kind (str): Specify kind="guest" to register as guest.
"""
query_params['kind'] = kind
return self._send(
"POST",
"/register",
Expand Down Expand Up @@ -209,7 +209,7 @@ def send_state_event(self, room_id, event_type, content, state_key="",
event_type(str): The state event type to send.
content(dict): The JSON content to send.
state_key(str): Optional. The state key for the event.
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
path = "/rooms/%s/state/%s" % (
quote(room_id), quote(event_type),
Expand All @@ -230,7 +230,7 @@ def send_message_event(self, room_id, event_type, content, txn_id=None,
event_type (str): The event type to send.
content (dict): The JSON content to send.
txn_id (int): Optional. The transaction ID to use.
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
if not txn_id:
txn_id = str(self.txn_id) + str(int(time() * 1000))
Expand Down Expand Up @@ -298,7 +298,7 @@ def send_location(self, room_id, geo_uri, name, thumb_url=None, thumb_info=None,
name (str): Description for the location.
thumb_url (str): URL to the thumbnail of the location.
thumb_info (dict): Metadata about the thumbnail, type ImageInfo.
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
content_pack = {
"geo_uri": geo_uri,
Expand All @@ -319,7 +319,7 @@ def send_message(self, room_id, text_content, msgtype="m.text", timestamp=None):
Args:
room_id (str): The room ID to send the event in.
text_content (str): The m.text body to send.
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
return self.send_message_event(
room_id, "m.room.message",
Expand All @@ -333,7 +333,7 @@ def send_emote(self, room_id, text_content, timestamp=None):
Args:
room_id (str): The room ID to send the event in.
text_content (str): The m.emote body to send.
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
return self.send_message_event(
room_id, "m.room.message",
Expand All @@ -347,7 +347,7 @@ def send_notice(self, room_id, text_content, timestamp=None):
Args:
room_id (str): The room ID to send the event in.
text_content (str): The m.notice body to send.
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
body = {
"msgtype": "m.notice",
Expand Down Expand Up @@ -391,7 +391,7 @@ def set_room_name(self, room_id, name, timestamp=None):
Args:
room_id (str): The room ID
name (str): The new room name
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
body = {
"name": name
Expand All @@ -410,7 +410,7 @@ def set_room_topic(self, room_id, topic, timestamp=None):
Args:
room_id (str): The room ID
topic (str): The new room topic
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
body = {
"topic": topic
Expand All @@ -433,10 +433,11 @@ def set_power_levels(self, room_id, content):
in the content arg are reset to default values.

Args:
room_id(str): The room ID
content(dict): The JSON content to send. See example content below.
room_id (str): The room ID
content (dict): The JSON content to send. See example content below.

Example::

Usage:
api = MatrixHttpApi("http://example.com", token="foobar")
api.set_power_levels("!exampleroom:example.com",
{
Expand Down Expand Up @@ -512,12 +513,13 @@ def get_membership(self, room_id, user_id):
def set_membership(self, room_id, user_id, membership, reason="", profile={},
timestamp=None):
"""Perform PUT /rooms/$room_id/state/m.room.member/$user_id

Args:
room_id (str): The room ID
user_id (str): The user ID
membership (str): New membership value
reason (str): The reason
timestamp (int): Optional. Set origin_server_ts (For application services only)
timestamp (int): Set origin_server_ts (For application services only)
"""
body = {
"membership": membership,
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ commands =
check-manifest

[testenv:docs]
deps = .[doc]
changedir = docs
commands = sphinx-build -W docs/source docs/build/html
commands = sphinx-build -W source build/html

[travis]
python =
Expand Down