Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 2aca84d

Browse files
[python_eval] v3
1 parent b7cd108 commit 2aca84d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

python_eval/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# -*- coding: utf-8 -*-
22
# Copyright (c) 2017-2014 Manuel Schneider
33

4-
from builtins import pow
5-
from math import *
64
from pathlib import Path
75

86
from albert import *
97

10-
md_iid = '2.3'
11-
md_version = "1.6"
8+
md_iid = "3.0"
9+
md_version = "2.0"
1210
md_name = "Python Eval"
1311
md_description = "Evaluate Python code"
1412
md_license = "BSD-3"
@@ -20,13 +18,15 @@ class Plugin(PluginInstance, TriggerQueryHandler):
2018

2119
def __init__(self):
2220
PluginInstance.__init__(self)
23-
TriggerQueryHandler.__init__(
24-
self, self.id, self.name, self.description,
25-
synopsis='<Python expression>',
26-
defaultTrigger='py '
27-
)
21+
TriggerQueryHandler.__init__(self)
2822
self.iconUrls = [f"file:{Path(__file__).parent}/python.svg"]
2923

24+
def synopsis(self, query):
25+
return "<Python expression>"
26+
27+
def defaultTrigger(self):
28+
return "py "
29+
3030
def handleTriggerQuery(self, query):
3131
stripped = query.string.strip()
3232
if stripped:
@@ -38,7 +38,7 @@ def handleTriggerQuery(self, query):
3838
result_str = str(result)
3939

4040
query.add(StandardItem(
41-
id=self.id,
41+
id=self.id(),
4242
text=result_str,
4343
subtext=type(result).__name__,
4444
inputActionText=query.trigger + result_str,

0 commit comments

Comments
 (0)