Skip to content

Commit 4d0e00e

Browse files
authored
Format chat folder (Mini-Conf#58)
* check chat folder as well * format * drive-by * ok * remove unused imports * lint * format
1 parent dfe495e commit 4d0e00e

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PYTHON_FILES = main.py scripts/
1+
PYTHON_FILES = main.py scripts/ chat/
22
JS_FILES = $(shell find static/js -name "*.js")
33
CSS_FILES = $(shell find static/css -name "*.css")
44
.PHONY: format-python format-web format run freeze format-check

chat/make_poster_rooms.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import argparse
22
import csv
3-
import random
4-
import string
3+
import json
54

5+
import yaml
66
from requests import sessions
7-
from pprint import pprint
87
from rocketchat_API.rocketchat import RocketChat
9-
import yaml
10-
import json
8+
119

1210
def parse_arguments():
1311
parser = argparse.ArgumentParser(description="MiniConf Portal Command Line")
1412
parser.add_argument("--config", default="config.yml", help="Configuration yaml")
1513
parser.add_argument("--papers", default="../sitedata/papers.csv", help="Papers CSV")
16-
parser.add_argument("--test", action='store_true')
14+
parser.add_argument("--test", action="store_true")
1715
return parser.parse_args()
1816

17+
1918
def read_papers(fname):
20-
name, typ = fname.split("/")[-1].split(".")
19+
_name, typ = fname.split("/")[-1].split(".")
2120
if typ == "json":
2221
res = json.load(open(fname))
2322
elif typ in {"csv", "tsv"}:
@@ -28,36 +27,33 @@ def read_papers(fname):
2827
raise ValueError("file not supported: " + fname)
2928
return res
3029

30+
3131
if __name__ == "__main__":
3232
args = parse_arguments()
3333

34-
3534
config = yaml.load(open(args.config))
3635
papers = read_papers(args.papers)
3736

3837
with sessions.Session() as session:
39-
rocket = RocketChat(config["username"],
40-
config["password"],
41-
server_url=config["server"],
42-
session=session)
38+
rocket = RocketChat(
39+
config["username"],
40+
config["password"],
41+
server_url=config["server"],
42+
session=session,
43+
)
4344

4445
for paper in papers:
4546
channel_name = "paper_" + paper["UID"]
4647
if not args.test:
4748
created = rocket.channels_create(channel_name).json()
4849
print(channel_name, created)
49-
id = rocket.channels_info(channel = channel_name).json()["channel"]["_id"]
50-
51-
52-
# Change to topic of papers.
53-
topic = "%s - %s"%(
54-
paper["title"],
55-
paper["authors"],
56-
)
50+
channel_id = rocket.channels_info(channel=channel_name).json()["channel"][
51+
"_id"
52+
]
53+
54+
# Change to topic of papers.
55+
topic = "%s - %s" % (paper["title"], paper["authors"],)
5756
if not args.test:
58-
rocket.channels_set_topic(id, topic).json()
57+
rocket.channels_set_topic(channel_id, topic).json()
5958

6059
print("Creating " + channel_name + " topic " + topic)
61-
62-
63-

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def papers():
8484

8585

8686
@app.route("/paper_vis.html")
87-
def paperVis():
87+
def paper_vis():
8888
data = _data()
8989
return render_template("papers_vis.html", **data)
9090

mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ strict_optional = False
66
[mypy-sklearn.*,transformers.*,flask_frozen.*,flaskext.*,ics.*]
77
ignore_missing_imports = True
88

9+
[mypy-rocketchat_API.*]
10+
ignore_missing_imports = True
11+

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ black==19.10b0
22
pylint==2.4.4
33
mypy==0.761
44
-r scripts/requirements.txt
5+
-r chat/requirements.txt

0 commit comments

Comments
 (0)