From 0013a74d72b11fc27f3cfd16f093f04ffee324fb Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Wed, 5 Jun 2019 13:24:19 +0200 Subject: [PATCH] drop class method identifier from docs Same result as in 92e3735d63584e490882526ebe146402a503f8fd, but now achieved by patching the Sphinx configuration instead of patching the API. Now it doesn't break the API for the purpose of checking and autocomplete, etc. --- doc/common/conf.py | 10 +++++++++- pybricks/_common.py | 14 -------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/doc/common/conf.py b/doc/common/conf.py index e00cf11..a8b9aca 100644 --- a/doc/common/conf.py +++ b/doc/common/conf.py @@ -19,7 +19,8 @@ # import os import sys -sys.path.insert(0, os.path.abspath('..')) +from sphinx.domains.python import PyClassmember +sys.path.insert(0, os.path.abspath('../..')) from pybricks import _version # noqa E402 @@ -249,3 +250,10 @@ texinfo_documents = [ author, 'Pybricks', 'One line description of project.', 'Miscellaneous'), ] + + +def get_signature_prefix_none(self, sig): + return '' + + +PyClassmember.get_signature_prefix = get_signature_prefix_none diff --git a/pybricks/_common.py b/pybricks/_common.py index 8a8a90e..9867fbd 100644 --- a/pybricks/_common.py +++ b/pybricks/_common.py @@ -346,12 +346,10 @@ class Motor(): class Display(): """Show images or text on a display.""" - @staticmethod def clear(self): """Clear everything on the display.""" pass - @staticmethod def text(self, text, coordinate=None): """Display text. @@ -364,7 +362,6 @@ class Display(): """ pass - @staticmethod def image(self, file_name, alignment=Align.CENTER, coordinate=None, clear=True): """image(file_name, alignment=Align.CENTER, coordinate=None, clear=True) @@ -391,7 +388,6 @@ class Display(): class Speaker(): """Play beeps and sound files using a speaker.""" - @staticmethod def beep(self, frequency=500, duration=100, volume=30): """Play a beep/tone. @@ -403,7 +399,6 @@ class Speaker(): """ pass - @staticmethod def beeps(self, number): """Play a number of default beeps with a brief pause in between. @@ -413,7 +408,6 @@ class Speaker(): """ pass - @staticmethod def file(self, file_name, volume=100): """Play a sound file. @@ -429,17 +423,14 @@ class Speaker(): class Light(): """Control a single color LED.""" - @staticmethod def on(self): """Turn on the light at maximum brightness.""" pass - @staticmethod def off(self): """Turn off the light.""" pass - @staticmethod def brightness(self, brightness): """Set the perceived brightness of the light. @@ -452,7 +443,6 @@ class Light(): class ColorLight(): """Control an RGB LED.""" - @staticmethod def color(self, color): """Turn on the light at the specified color. @@ -462,12 +452,10 @@ class ColorLight(): """ pass - @staticmethod def off(self): """Turn off the light.""" pass - @staticmethod def brightness(self, red, green, blue): """Set the perceived brightness of the red, green, and blue light. @@ -482,7 +470,6 @@ class ColorLight(): class Battery(): """Get the status of a battery.""" - @staticmethod def voltage(self): """Get the voltage of the battery. @@ -491,7 +478,6 @@ class Battery(): """ pass - @staticmethod def current(self): """Get the current supplied by the battery.