pyupgrade: Replace Text
with str
.
We uses `pyupgrade --py3-plus` to automatically replace all occurence of `Text`. But manual fix is required to remove the unused imports. Note that with this configuration pyupgrade also convert string literals to .format(...) style, which is manually not included in the commit as well.
This commit is contained in:
parent
a54cccc012
commit
e27ac0ddbe
11 changed files with 42 additions and 46 deletions
|
@ -13,7 +13,6 @@ import os
|
|||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import Text
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
import zulip_git_config as config
|
||||
|
@ -33,7 +32,7 @@ client = zulip.Client(
|
|||
)
|
||||
|
||||
|
||||
def git_repository_name() -> Text:
|
||||
def git_repository_name() -> str:
|
||||
output = subprocess.check_output(["git", "rev-parse", "--is-bare-repository"])
|
||||
if output.strip() == "true":
|
||||
return os.path.basename(os.getcwd())[: -len(".git")]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
from typing import Dict, Optional, Text
|
||||
from typing import Dict, Optional
|
||||
|
||||
# Name of the stream to send notifications to, default is "commits"
|
||||
STREAM_NAME = "commits"
|
||||
|
@ -23,7 +23,7 @@ ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
|||
# * stream "commits"
|
||||
# * topic "master"
|
||||
# And similarly for branch "test-post-receive" (for use when testing).
|
||||
def commit_notice_destination(repo: Text, branch: Text, commit: Text) -> Optional[Dict[Text, Text]]:
|
||||
def commit_notice_destination(repo: str, branch: str, commit: str) -> Optional[Dict[str, str]]:
|
||||
if branch in ["master", "test-post-receive"]:
|
||||
return dict(stream=STREAM_NAME, subject="%s" % (branch,))
|
||||
|
||||
|
@ -36,7 +36,7 @@ def commit_notice_destination(repo: Text, branch: Text, commit: Text) -> Optiona
|
|||
# graphical repository viewer, e.g.
|
||||
#
|
||||
# return '!avatar(%s) [%s](https://example.com/commits/%s)\n' % (author, subject, commit_id)
|
||||
def format_commit_message(author: Text, subject: Text, commit_id: Text) -> Text:
|
||||
def format_commit_message(author: str, subject: str, commit_id: str) -> str:
|
||||
return "!avatar(%s) %s\n" % (author, subject)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue