From a9c681818a6bbefc98f32f0fa07bd1b7bd97a0ae Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 3 Jul 2019 23:42:32 +0200 Subject: [PATCH] Enable strict/explicit code highlighting --- docs/api.rst | 3 +-- docs/conf.py | 11 +++++------ docs/install.rst | 19 +++++++++++++------ docs/testing.rst | 5 +++-- fbchat/_message.py | 8 ++++---- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index ba29e44..3d9a920 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,5 +1,4 @@ -.. currentmodule:: fbchat -.. highlight:: python +.. module:: fbchat .. _api: .. Note: we're using () to hide the __init__ method where relevant diff --git a/docs/conf.py b/docs/conf.py index d9c243d..3a6dde4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,12 +54,7 @@ master_doc = "index" # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] -rst_prolog = """ -.. highlight:: python -.. currentmodule:: {} -""".format( - project -) +rst_prolog = ".. currentmodule:: " + project # The reST default role (used for this markup: `text`) to use for all # documents. @@ -70,6 +65,10 @@ default_role = "any" # nitpicky = True +# Prefer strict Python highlighting +# +highlight_language = "python3" + # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = False diff --git a/docs/install.rst b/docs/install.rst index 672330a..fda0cd3 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -1,4 +1,3 @@ -.. highlight:: sh .. _install: Installation @@ -7,7 +6,9 @@ Installation Pip Install fbchat ------------------ -To install fbchat, run this command:: +To install fbchat, run this command: + +.. code-block:: sh $ pip install fbchat @@ -21,16 +22,22 @@ Get the Source Code fbchat is developed on GitHub, where the code is `always available `_. -You can either clone the public repository:: +You can either clone the public repository: + +.. code-block:: sh $ git clone git://github.com/carpedm20/fbchat.git -Or, download a `tarball `_:: +Or, download a `tarball `_: + +.. code-block:: sh $ curl -OL https://github.com/carpedm20/fbchat/tarball/master - # optionally, zipball is also available (for Windows users). + # optionally, zipball is also available (for Windows users). Once you have a copy of the source, you can embed it in your own Python -package, or install it into your site-packages easily:: +package, or install it into your site-packages easily: + +.. code-block:: sh $ python setup.py install diff --git a/docs/testing.rst b/docs/testing.rst index 75d11d9..16dbd57 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -1,4 +1,3 @@ -.. highlight:: sh .. _testing: Testing @@ -14,7 +13,9 @@ To use the tests, copy ``tests/data.json`` to ``tests/my_data.json`` or type the Please remember to test all supported python versions. If you've made any changes to the 2FA functionality, test it with a 2FA enabled account. -If you only want to execute specific tests, pass the function names in the command line (not including the ``test_`` prefix). Example:: +If you only want to execute specific tests, pass the function names in the command line (not including the ``test_`` prefix). Example: + +.. code-block:: sh $ python tests.py sendMessage sessions sendEmoji diff --git a/fbchat/_message.py b/fbchat/_message.py index 3a67cbf..e4d886c 100644 --- a/fbchat/_message.py +++ b/fbchat/_message.py @@ -99,11 +99,11 @@ class Message(object): Returns a `Message` object, with the formatted string and relevant mentions. - >>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) - , ] emoji_size=None attachments=[]> + >>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) + , ] emoji_size=None attachments=[]> - >>> Message.formatMentions("Hey {p}! My name is {}", ("1234", "Michael"), p=("4321", "Peter")) - , ] emoji_size=None attachments=[]> + >>> Message.formatMentions("Hey {p}! My name is {}", ("1234", "Michael"), p=("4321", "Peter")) + , ] emoji_size=None attachments=[]> """ result = "" mentions = list()