Skip to content

Commit 8eb3d4e

Browse files
committed
Upgrade requirements.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 2ecabb3 commit 8eb3d4e

File tree

5 files changed

+12
-35
lines changed

5 files changed

+12
-35
lines changed

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
crayons
22
twine
3-
black==23.3.0
3+
black~=23.10.1
44
isort
55
flake8
66
mock
@@ -9,8 +9,8 @@ pytest-cov
99
-e ./zulip
1010
-e ./zulip_bots
1111
-e ./zulip_botserver
12-
-e git+https://github.com/zulip/zulint@14e3974001bf8442a6a3486125865660f1f2eb68#egg=zulint==1.0.0
13-
mypy==0.910
12+
-e git+https://github.com/zulip/zulint@85de0cbadbba3f498deba32f861bb9a478faa3b4#egg=zulint==1.0.0
13+
mypy==1.6.1
1414
types-python-dateutil
1515
types-pytz
1616
types-requests

tools/custom_check.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,29 @@
44

55
whitespace_rules: List[Rule] = [
66
# This linter should be first since bash_rules depends on it.
7-
{"pattern": r"\s+$", "strip": "\n", "description": "Fix trailing whitespace"},
8-
{"pattern": "\t", "strip": "\n", "description": "Fix tab-based whitespace"},
7+
{"pattern": r"[\t ]+$", "description": "Fix trailing whitespace"},
8+
{"pattern": r"\t", "description": "Fix tab-based whitespace"},
99
]
1010

1111
markdown_whitespace_rules = list(
12-
rule for rule in whitespace_rules if rule["pattern"] != r"\s+$"
12+
rule for rule in whitespace_rules if rule["pattern"] != r"[\t ]+$"
1313
) + [
1414
# Two spaces trailing a line with other content is okay--it's a markdown line break.
1515
# This rule finds one space trailing a non-space, three or more trailing spaces, and
1616
# spaces on an empty line.
1717
{
18-
"pattern": r"((?<!\s)\s$)|(\s\s\s+$)|(^\s+$)",
19-
"strip": "\n",
18+
"pattern": r"((?<![\t ])[\t ]$)|([\t ][\t ][\t ]+$)|(^[\t ]+$)",
2019
"description": "Fix trailing whitespace",
2120
},
2221
{
2322
"pattern": r"^#+[A-Za-z0-9]",
24-
"strip": "\n",
2523
"description": "Missing space after # in heading",
2624
},
2725
]
2826

2927
python_rules = RuleList(
3028
langs=["py"],
3129
rules=[
32-
{"pattern": r'".*"%\([a-z_].*\)?$', "description": 'Missing space around "%"'},
33-
{"pattern": r"'.*'%\([a-z_].*\)?$", "description": 'Missing space around "%"'},
34-
# This rule is constructed with + to avoid triggering on itself
35-
{"pattern": r" =" + r'[^ =>~"]', "description": 'Missing whitespace after "="'},
36-
{"pattern": r'":\w[^"]*$', "description": 'Missing whitespace after ":"'},
37-
{"pattern": r"':\w[^']*$", "description": 'Missing whitespace after ":"'},
38-
{"pattern": r"^\s+[#]\w", "strip": "\n", "description": 'Missing whitespace after "#"'},
3930
{
4031
"pattern": r"assertEquals[(]",
4132
"description": "Use assertEqual, not assertEquals (which is deprecated).",
@@ -46,13 +37,6 @@
4637
"good_lines": ["def foo (self):"],
4738
"bad_lines": ["def foo(self: Any):"],
4839
},
49-
{"pattern": r"== None", "description": "Use `is None` to check whether something is None"},
50-
{"pattern": r"type:[(]", "description": 'Missing whitespace after ":" in type annotation'},
51-
{"pattern": r"# type [(]", "description": "Missing : after type in type annotation"},
52-
{"pattern": r"#type", "description": 'Missing whitespace after "#" in type annotation'},
53-
{"pattern": r"if[(]", "description": "Missing space between if and ("},
54-
{"pattern": r", [)]", "description": 'Unnecessary whitespace between "," and ")"'},
55-
{"pattern": r"% [(]", "description": 'Unnecessary whitespace between "%" and "("'},
5640
# This next check could have false positives, but it seems pretty
5741
# rare; if we find any, they can be added to the exclude list for
5842
# this rule.
@@ -97,7 +81,6 @@
9781
},
9882
*whitespace_rules,
9983
],
100-
max_length=140,
10184
)
10285

10386
bash_rules = RuleList(
@@ -145,10 +128,6 @@
145128
},
146129
]
147130

148-
markdown_docs_length_exclude = {
149-
"zulip_bots/zulip_bots/bots/converter/doc.md",
150-
}
151-
152131
markdown_rules = RuleList(
153132
langs=["md"],
154133
rules=[
@@ -159,8 +138,6 @@
159138
"description": "Linkified markdown URLs should use cleaner <http://example.com> syntax.",
160139
},
161140
],
162-
max_length=120,
163-
length_exclude=markdown_docs_length_exclude,
164141
)
165142

166143
txt_rules = RuleList(

zulip/tests/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import pkgutil
2-
from typing import List
32

4-
__path__: List[str] = pkgutil.extend_path(__path__, __name__)
3+
__path__ = pkgutil.extend_path(__path__, __name__)

zulip_botserver/tests/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import pkgutil
2-
from typing import List
32

4-
__path__: List[str] = pkgutil.extend_path(__path__, __name__)
3+
__path__ = pkgutil.extend_path(__path__, __name__)

zulip_botserver/zulip_botserver/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def load_bot_handlers(
149149
api_key=bots_config[bot]["key"],
150150
site=bots_config[bot]["site"],
151151
)
152-
bot_dir = os.path.join(os.path.dirname(os.path.abspath(bot_lib_modules[bot].__file__)))
152+
bot_file = bot_lib_modules[bot].__file__
153+
assert bot_file is not None
154+
bot_dir = os.path.dirname(os.path.abspath(bot_file))
153155
bot_handler = lib.ExternalBotHandler(
154156
client, bot_dir, bot_details={}, bot_config_parser=third_party_bot_conf
155157
)

0 commit comments

Comments
 (0)