plugin XEP-0060: type hints
This commit is contained in:
parent
ead62068ce
commit
11d003b8c1
1 changed files with 25 additions and 16 deletions
|
|
@ -17,26 +17,28 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from typing import Optional, List, Tuple, Dict, Union
|
||||
from collections import namedtuple
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
from functools import reduce
|
||||
from zope.interface import implementer
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.words.protocols.jabber import error, jid
|
||||
from twisted.words.xish import domish
|
||||
from twisted.words.protocols.jabber import jid, error
|
||||
from twisted.internet import reactor, defer
|
||||
from wokkel import disco
|
||||
from wokkel import data_form
|
||||
# XXX: sat_tmp.wokkel.pubsub is actually use instead of wokkel version
|
||||
# mam and rsm come from sat_tmp.wokkel too
|
||||
from wokkel import pubsub
|
||||
from wokkel import rsm
|
||||
from wokkel import mam
|
||||
from sat.core.i18n import _
|
||||
from sat.core.constants import Const as C
|
||||
from sat.core.log import getLogger
|
||||
from sat.core.core_types import SatXMPPEntity
|
||||
from zope.interface import implementer
|
||||
|
||||
from sat.core import exceptions
|
||||
from sat.core.constants import Const as C
|
||||
from sat.core.core_types import SatXMPPEntity
|
||||
from sat.core.i18n import _
|
||||
from sat.core.log import getLogger
|
||||
from sat.tools import utils
|
||||
from sat.tools import sat_defer
|
||||
from sat.tools import xml_tools
|
||||
|
|
@ -558,15 +560,22 @@ class XEP_0060(object):
|
|||
except IndexError:
|
||||
return item_id
|
||||
|
||||
async def sendItems(self, client, service, nodeIdentifier, items, extra=None):
|
||||
async def sendItems(
|
||||
self,
|
||||
client: SatXMPPEntity,
|
||||
service: jid.JID,
|
||||
nodeIdentifier: str,
|
||||
items: List[domish.Element],
|
||||
extra: Optional[Dict[str, Any]] = None
|
||||
) -> List[str]:
|
||||
"""High level method to send several items at once
|
||||
|
||||
@param service(jid.JID, None): service to send the item to
|
||||
@param service: service to send the item to
|
||||
None to use PEP
|
||||
@param NodeIdentifier(unicode): PubSub node to use
|
||||
@param items(list[domish.Element]): whole item elements to send,
|
||||
@param NodeIdentifier: PubSub node to use
|
||||
@param items: whole item elements to send,
|
||||
"id" will be used if set
|
||||
@param extra(dict, None): extra options. Key can be:
|
||||
@param extra: extra options. Key can be:
|
||||
- self.EXTRA_PUBLISH_OPTIONS(dict): publish options, cf. XEP-0060 § 7.1.5
|
||||
the dict maps option name to value(s)
|
||||
- self.EXTRA_ON_PRECOND_NOT_MET(str): policy to have when publishing is
|
||||
|
|
@ -575,7 +584,7 @@ class XEP_0060(object):
|
|||
* publish_without_options: re-publish without the publish-options.
|
||||
A warning will be logged showing that the publish-options could not
|
||||
be used
|
||||
@return (list[unicode]): ids of the created items
|
||||
@return: ids of the created items
|
||||
"""
|
||||
if extra is None:
|
||||
extra = {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue