Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
203
Issues
203
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
d0551c09
Commit
d0551c09
authored
Mar 26, 2021
by
mathieui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: typing issues in plugins
parent
d27895e0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
11 deletions
+18
-11
plugins/b64.py
plugins/b64.py
+5
-3
plugins/emoji_ascii.py
plugins/emoji_ascii.py
+4
-2
plugins/qr.py
plugins/qr.py
+2
-1
plugins/screen_detach.py
plugins/screen_detach.py
+2
-2
plugins/untrackme.py
plugins/untrackme.py
+1
-1
plugins/user_extras.py
plugins/user_extras.py
+2
-0
poezio/plugin.py
poezio/plugin.py
+2
-2
No files found.
plugins/b64.py
View file @
d0551c09
...
...
@@ -24,7 +24,9 @@ This plugin also respects security guidelines listed in XEP-0419.
from
base64
import
b64decode
,
b64encode
from
poezio.plugin_e2ee
import
E2EEPlugin
from
slixmpp
import
Message
from
poezio.tabs
import
ChatTab
from
slixmpp
import
Message
,
JID
from
typing
import
Optional
class
Plugin
(
E2EEPlugin
):
...
...
@@ -37,14 +39,14 @@ class Plugin(E2EEPlugin):
# This encryption mechanism is using <body/> as a container
replace_body_with_eme
=
False
def
decrypt
(
self
,
message
:
Message
,
_t
ab
)
->
None
:
async
def
decrypt
(
self
,
message
:
Message
,
jid
:
Optional
[
JID
],
_tab
:
ChatT
ab
)
->
None
:
"""
Decrypt base64
"""
body
=
message
[
'body'
]
message
[
'body'
]
=
b64decode
(
body
.
encode
()).
decode
()
def
encrypt
(
self
,
message
:
Message
,
_t
ab
)
->
None
:
async
def
encrypt
(
self
,
message
:
Message
,
jid
:
Optional
[
JID
],
_tab
:
ChatT
ab
)
->
None
:
"""
Encrypt to base64
"""
...
...
plugins/emoji_ascii.py
View file @
d0551c09
...
...
@@ -21,10 +21,12 @@ import os
import
re
from
poezio.plugin
import
BasePlugin
from
typing
import
Dict
class
Plugin
(
BasePlugin
):
emoji_to_ascii
=
{}
ascii_to_emoji
=
{}
emoji_to_ascii
:
Dict
[
str
,
str
]
=
{}
ascii_to_emoji
:
Dict
[
str
,
str
]
=
{}
emoji_pattern
=
None
alias_pattern
=
None
...
...
plugins/qr.py
View file @
d0551c09
...
...
@@ -3,7 +3,8 @@
import
io
import
logging
import
qrcode
import
sys
from
typing
import
Dict
,
Callable
from
poezio
import
windows
from
poezio.tabs
import
Tab
...
...
plugins/screen_detach.py
View file @
d0551c09
...
...
@@ -43,10 +43,10 @@ DEFAULT_CONFIG = {
# overload if this is not how your stuff
# is configured
try
:
LOGIN
=
os
.
getlogin
()
LOGIN
=
os
.
getlogin
()
or
''
LOGIN_TMUX
=
os
.
getuid
()
except
Exception
:
LOGIN
=
os
.
getenv
(
'USER'
)
LOGIN
=
os
.
getenv
(
'USER'
)
or
''
LOGIN_TMUX
=
os
.
getuid
()
SCREEN_DIR
=
'/var/run/screens/S-%s'
%
LOGIN
...
...
plugins/untrackme.py
View file @
d0551c09
...
...
@@ -49,7 +49,7 @@ def proxy(service: str) -> Callable[[str], str]:
class
Plugin
(
BasePlugin
):
"""UntrackMe"""
default_config
:
Dict
[
str
,
str
]
=
{
default_config
:
Dict
[
str
,
Dict
[
str
,
Union
[
str
,
bool
]]
]
=
{
'default'
:
{
'cleanup'
:
True
,
'redirect'
:
True
,
...
...
plugins/user_extras.py
View file @
d0551c09
...
...
@@ -369,6 +369,8 @@ class Plugin(BasePlugin):
return
if
activity
[
0
]:
general
=
ACTIVITIES
.
get
(
activity
[
0
])
if
general
is
None
:
return
s
=
general
[
'category'
]
if
activity
[
1
]:
s
=
s
+
'/'
+
general
.
get
(
activity
[
1
],
'other'
)
...
...
poezio/plugin.py
View file @
d0551c09
...
...
@@ -4,7 +4,7 @@ These are used in the plugin system added in poezio 0.7.5
(see plugin_manager.py)
"""
from
typing
import
Any
,
Dict
,
Set
from
typing
import
Any
,
Dict
,
Set
,
Optional
from
asyncio
import
iscoroutinefunction
from
functools
import
partial
from
configparser
import
RawConfigParser
...
...
@@ -404,7 +404,7 @@ class BasePlugin(object, metaclass=SafetyMetaclass):
# Internal use only
_unloading
=
False
default_config
=
None
default_config
:
Optional
[
Dict
[
Any
,
Any
]]
=
None
dependencies
:
Set
[
str
]
=
set
()
# This dict will get populated when the plugin is initialized
refs
:
Dict
[
str
,
Any
]
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment