Compare commits

...

5 commits

Author SHA1 Message Date
acb40bd5fd
The test step should also install all dependencies via apk add.
Some checks failed
continuous-integration/drone/push Build is failing
2023-09-30 13:36:28 +02:00
4f5ccda353
Better documentation for the calendar plugin. 2023-09-30 13:31:41 +02:00
7bd721e6a4
Added missing pip install parameter. 2023-09-30 13:31:04 +02:00
c82f7bbfbe
Ignore the default docstring text for __init__.
If no docstring is specified for a constructor, Python usually pre-fills
a standard text - "Initialize self. See help(type(self))".

We don't need this default text in our plugins documentation.
2023-09-30 13:29:49 +02:00
d030e2b8c7
Install all the deps via apk add on Alpine in the build-docs step. 2023-09-30 13:29:10 +02:00
4 changed files with 23 additions and 23 deletions

View file

@ -49,7 +49,7 @@ steps:
commands:
- echo "Installing required build dependencies"
- apk add --update --no-cache make py3-sphinx py3-pip py3-paho-mqtt py3-yaml
- apk add --update --no-cache make py3-sphinx py3-pip $(cat platypush/install/requirements/alpine.txt)
- pip install -U hid sphinx-rtd-theme sphinx-book-theme
- pip install .
- mkdir -p /docs/current
@ -76,14 +76,11 @@ steps:
###
- name: tests
image: python:3.11-alpine
image: alpine
commands:
- apk add --update --no-cache redis
- apk add --update --no-cache --virtual build-base g++ rust linux-headers
- pip install -U pip
- apk add --update --no-cache $(cat platypush/install/requirements/alpine.txt)
- pip install .
- pip install -r requirements-tests.txt
- apk del build-base g++ rust linux-headers
- pytest tests
###

View file

@ -80,7 +80,9 @@ class IntegrationEnricher:
idx += 1
if parsed_deps['pip']:
source.insert(idx, cls._shellify('pip', 'pip ' + ' '.join(deps.pip)))
source.insert(
idx, cls._shellify('pip', 'pip install ' + ' '.join(deps.pip))
)
idx += 1
for pkg_manager, sys_deps in deps.by_pkg_manager.items():

View file

@ -1,3 +1,5 @@
from typing import Collection
import dateutil.parser
import importlib
@ -20,31 +22,25 @@ class CalendarPlugin(Plugin, CalendarInterface):
iCal URLs) and get joined events from all of them.
"""
def __init__(self, calendars=None, *args, **kwargs):
def __init__(self, calendars: Collection[dict], *args, **kwargs):
"""
:param calendars: List of calendars to be queried. Supported types so far: Google Calendar and iCal URLs.
:type calendars: list
Example format::
Example:
calendars = [
{
"type": "platypush.plugins.google.calendar.GoogleCalendarPlugin"
},
.. code-block:: yaml
{
"type": "platypush.plugins.calendar.ical.IcalCalendarPlugin",
"url": "https://www.facebook.com/ical/u.php?uid=USER_ID&key=FB_KEY"
},
calendars:
# Use the Google Calendar integration
- type: platypush.plugins.google.calendar.GoogleCalendarPlugin
# Import the Facebook events calendar via iCal URL
- type: platypush.plugins.calendar.ical.IcalCalendarPlugin
url: https://www.facebook.com/ical/u.php?uid=USER_ID&key=FB_KEY
...
]
"""
super().__init__(*args, **kwargs)
if calendars is None:
calendars = []
self.calendars = []
for calendar in calendars:

View file

@ -99,6 +99,7 @@ class DocstringParser:
_param_doc_re = re.compile(r"^:param\s+(?P<name>[\w_]+):\s+(?P<doc>.*)$")
_type_doc_re = re.compile(r"^:type\s+[\w_]+:.*$")
_return_doc_re = re.compile(r"^:return:\s+(?P<doc>.*)$")
_default_docstring = re.compile(r"^Initialize self. See help")
def __init__(
self,
@ -164,6 +165,10 @@ class DocstringParser:
ctx.state = ParseState.TYPE
return
# Ignore the default constructor docstring
if cls._default_docstring.match(line):
return
# Update the return type docstring if required
m = cls._return_doc_re.match(line)
if m or (ctx.state == ParseState.RETURN and cls._is_continuation_line(line)):