Skip to content

Commit 7e20002

Browse files
committed
use python 3.9+ syntax
using pyupgrade
1 parent 2a70d8a commit 7e20002

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ def find_source():
7777
filename = '{}#L{:d}-L{:d}'.format(*find_source())
7878
except Exception:
7979
filename = info['module'].replace('.', '/') + '.py'
80-
return "https://github.com/Findus23/pyLanguagetool/blob/master/{}".format(filename)
80+
return f"https://github.com/Findus23/pyLanguagetool/blob/master/{filename}"

pylanguagetool/cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_input_text(config):
121121
return None, None
122122
extension = os.path.splitext(config["input file"])[1][1:] # get file extention without .
123123
try:
124-
with open(config["input file"], 'r') as myfile:
124+
with open(config["input file"]) as myfile:
125125
return myfile.read(), extension
126126
except UnicodeDecodeError:
127127
print("can't read text")
@@ -150,8 +150,8 @@ def colored(text, color):
150150
, Fore.LIGHTBLACK_EX))
151151
print()
152152

153-
tick = colored(u"\u2713", Fore.LIGHTGREEN_EX) + " "
154-
cross = colored(u"\u2717", Fore.LIGHTRED_EX) + " "
153+
tick = colored("\u2713", Fore.LIGHTGREEN_EX) + " "
154+
cross = colored("\u2717", Fore.LIGHTRED_EX) + " "
155155

156156
rule_explanations = []
157157

@@ -209,7 +209,7 @@ def colored(text, color):
209209
print(descr + ":" + " " * (col_len - len(descr)) + url)
210210
print()
211211

212-
print(colored("Text checked by {url} ({version})".format(url=api_url, version=version), Fore.LIGHTBLACK_EX))
212+
print(colored(f"Text checked by {api_url} ({version})", Fore.LIGHTBLACK_EX))
213213

214214

215215
def main():
@@ -219,7 +219,7 @@ def main():
219219
print(sys.version)
220220

221221
if config['pwl']:
222-
with open(config['pwl'], 'r') as fs:
222+
with open(config['pwl']) as fs:
223223
config['pwl'] = [w.strip() for w in fs.readlines()]
224224

225225
input_text, inputtype = get_input_text(config)

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_cli(capsys):
8383
],
8484
}
8585

86-
should_output = u"""German (Austria) detected (100% confidence)
86+
should_output = """German (Austria) detected (100% confidence)
8787
8888
Dieser Satz fängt nicht mit einem großgeschriebenen Wort an
8989
✗ das ist ein est

0 commit comments

Comments
 (0)