Reformatted code base using black.
This commit is contained in:
parent
56319cbad3
commit
53fdaa9d09
1 changed files with 12604 additions and 8966 deletions
|
|
@ -53,21 +53,35 @@ class FileSharingInvitation:
|
|||
in_sign="ssssssss",
|
||||
out_sign="",
|
||||
method=self._send_file_sharing_invitation,
|
||||
async_=True
|
||||
async_=True,
|
||||
)
|
||||
|
||||
def _send_file_sharing_invitation(
|
||||
self, invitee_jid_s, service_s, repos_type=None, namespace=None, path=None,
|
||||
name=None, extra_s='', profile_key=C.PROF_KEY_NONE):
|
||||
self,
|
||||
invitee_jid_s,
|
||||
service_s,
|
||||
repos_type=None,
|
||||
namespace=None,
|
||||
path=None,
|
||||
name=None,
|
||||
extra_s="",
|
||||
profile_key=C.PROF_KEY_NONE,
|
||||
):
|
||||
client = self.host.get_client(profile_key)
|
||||
invitee_jid = jid.JID(invitee_jid_s)
|
||||
service = jid.JID(service_s)
|
||||
extra = data_format.deserialise(extra_s)
|
||||
return defer.ensureDeferred(
|
||||
self.host.plugins["INVITATION"].send_file_sharing_invitation(
|
||||
client, invitee_jid, service, repos_type=repos_type or None,
|
||||
namespace=namespace or None, path=path or None, name=name or None,
|
||||
extra=extra)
|
||||
client,
|
||||
invitee_jid,
|
||||
service,
|
||||
repos_type=repos_type or None,
|
||||
namespace=namespace or None,
|
||||
path=path or None,
|
||||
name=name or None,
|
||||
extra=extra,
|
||||
)
|
||||
)
|
||||
|
||||
def on_invitation(
|
||||
|
|
@ -79,25 +93,31 @@ class FileSharingInvitation:
|
|||
service: jid.JID,
|
||||
repos_type: str,
|
||||
sharing_ns: str,
|
||||
path: str
|
||||
path: str,
|
||||
):
|
||||
if repos_type == "files":
|
||||
type_human = _("file sharing")
|
||||
elif repos_type == "photos":
|
||||
type_human = _("photo album")
|
||||
else:
|
||||
log.warning("Unknown repository type: {repos_type}".format(
|
||||
repos_type=repos_type))
|
||||
log.warning(
|
||||
"Unknown repository type: {repos_type}".format(repos_type=repos_type)
|
||||
)
|
||||
repos_type = "file"
|
||||
type_human = _("file sharing")
|
||||
log.info(_(
|
||||
'{profile} has received an invitation for a files repository ({type_human}) '
|
||||
'with namespace {sharing_ns!r} at path [{path}]').format(
|
||||
profile=client.profile, type_human=type_human, sharing_ns=sharing_ns,
|
||||
path=path)
|
||||
log.info(
|
||||
_(
|
||||
"{profile} has received an invitation for a files repository ({type_human}) "
|
||||
"with namespace {sharing_ns!r} at path [{path}]"
|
||||
).format(
|
||||
profile=client.profile,
|
||||
type_human=type_human,
|
||||
sharing_ns=sharing_ns,
|
||||
path=path,
|
||||
)
|
||||
)
|
||||
return defer.ensureDeferred(
|
||||
self.host.plugins['LIST_INTEREST'].register_file_sharing(
|
||||
self.host.plugins["LIST_INTEREST"].register_file_sharing(
|
||||
client, service, repos_type, sharing_ns, path, name, extra
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue