Skip to content

Commit 341ae46

Browse files
committed
pyupgrade --py39-plus *.py
1 parent 54220b8 commit 341ae46

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

Build.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python
2-
# encoding: utf-8
32

43
from os import walk
54
from os.path import join
@@ -23,7 +22,7 @@ def main():
2322
with open("version") as f:
2423
version = f.readline().rstrip("\n\r ")
2524

26-
zip_filename = "time-converter.{}.alfredworkflow".format(version)
25+
zip_filename = f"time-converter.{version}.alfredworkflow"
2726
z = ZipFile(zip_filename, mode="w")
2827

2928
for filename in FILENAME_LIST:
@@ -37,7 +36,7 @@ def main():
3736

3837
z.close()
3938

40-
print("Create Alfred workflow({}) finished.".format(zip_filename))
39+
print(f"Create Alfred workflow({zip_filename}) finished.")
4140

4241

4342
if __name__ == "__main__":

core.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python
2-
# encoding: utf-8
32

43

54
import re
@@ -54,7 +53,7 @@
5453
RE_SHIFT = "^[+-][0-9]+[smhdwMy]$"
5554

5655

57-
class Time(object):
56+
class Time:
5857
wf = None
5958
_query = None
6059

@@ -77,7 +76,7 @@ def query(self, value):
7776

7877
def do_parser(self):
7978
self.wf.logger.debug(
80-
"query string:{} {}".format(type(self.wf.args[0]), self.wf.args[0])
79+
f"query string:{type(self.wf.args[0])} {self.wf.args[0]}"
8180
)
8281

8382
try:
@@ -107,22 +106,22 @@ def _parser_extend_info(self):
107106
if info.upper() == "UTC" or info == "+00" or info == "-00":
108107
self.query = query
109108
self.zone = "UTC"
110-
self.wf.logger.debug("found zone info:{}".format(self.zone))
109+
self.wf.logger.debug(f"found zone info:{self.zone}")
111110
return True
112111

113112
r = re.match(RE_TIMEZONE, info)
114113
if r:
115114
self.query = query
116115
self.zone = info
117-
self.wf.logger.debug("found zone info:{}".format(self.zone))
116+
self.wf.logger.debug(f"found zone info:{self.zone}")
118117
return True
119118

120119
# time shift TODO
121120
r = re.match(RE_SHIFT, info)
122121
if r:
123122
self.query = query
124123
self.shift = info
125-
self.wf.logger.debug("found shift info:{}".format(self.shift))
124+
self.wf.logger.debug(f"found shift info:{self.shift}")
126125
return True
127126

128127
return False
@@ -145,7 +144,7 @@ def _parser_datetime(self):
145144
self.time = arrow.now()
146145
return True
147146

148-
self.wf.logger.debug("parser datetime error,query string:{}".format(self.query))
147+
self.wf.logger.debug(f"parser datetime error,query string:{self.query}")
149148
return False
150149

151150
def _apply_shift(self):
@@ -173,7 +172,7 @@ def get_feedback(self):
173172
for icon, force_utc, fmt, desc_format in FORMAT_LIST:
174173
# time shift
175174
if self.shift:
176-
desc_shift = "{}, ".format(self.shift)
175+
desc_shift = f"{self.shift}, "
177176
else:
178177
desc_shift = ""
179178

entry_point.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python
2-
# encoding: utf-8
32

43
import sys
54

0 commit comments

Comments
 (0)