Skip to content

Commit 091c878

Browse files
committed
fix lint
1 parent 019a7b6 commit 091c878

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

packet/context_processors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def get_rit_image(username: str) -> str:
6262
for addr in addresses:
6363
url = 'https://gravatar.com/avatar/' + hashlib.md5(addr.encode('utf8')).hexdigest() + '.jpg?d=404&s=250'
6464
try:
65-
gravatar = urllib.request.urlopen(url)
66-
if gravatar.getcode() == 200:
67-
return url
65+
with urllib.request.urlopen(url) as gravatar:
66+
if gravatar.getcode() == 200:
67+
return url
6868
except:
6969
continue
7070
return 'https://www.gravatar.com/avatar/freshmen?d=mp&f=y'

packet/ldap.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
class MockMember:
1515

16-
def __init__(self, uid: str, groups: list = None, cn: str = None, room_number: int = None):
16+
def __init__(self,
17+
uid: str,
18+
groups: Optional[list] = None,
19+
cn: Optional[str] = None,
20+
room_number: Optional[int] = None):
1721
self.uid = uid
1822
self.groups = groups if groups else list()
1923
if room_number:
@@ -37,7 +41,7 @@ def __repr__(self) -> str:
3741

3842
class LDAPWrapper:
3943

40-
def __init__(self, cshldap: CSHLDAP = None, mock_members: list[MockMember] = None):
44+
def __init__(self, cshldap: Optional[CSHLDAP] = None, mock_members: Optional[list[MockMember]] = None):
4145
self.ldap = cshldap
4246
self.mock_members = cast(list[MockMember], mock_members)
4347
if self.ldap:

packet/mail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ReportForm(TypedDict):
1515

1616
def send_start_packet_mail(packet: Packet) -> None:
1717
if app.config['MAIL_PROD']:
18-
recipients = ['<' + packet.freshman.rit_username + '@rit.edu>']
18+
recipients = ['<' + str(packet.freshman.rit_username) + '@rit.edu>']
1919
msg = Message(subject='CSH Packet Starts ' + packet.start.strftime('%A, %B %-d'),
2020
sender=app.config.get('MAIL_USERNAME'),
2121
recipients=recipients)

packet/routes/freshmen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Routes available to freshmen only
33
"""
44

5-
from flask import redirect, url_for
5+
from flask import Response, redirect, url_for
66

77
from packet import app
88
from packet.models import Packet
@@ -12,7 +12,7 @@
1212
@app.route('/')
1313
@packet_auth
1414
@before_request
15-
def index(info=None):
15+
def index(info=None) -> Response:
1616
most_recent_packet = Packet.query.filter_by(freshman_username=info['uid']).order_by(Packet.id.desc()).first()
1717

1818
if most_recent_packet is not None:

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Flask-Mail==0.10.0
33
Flask-Migrate~=2.7.0
44
Flask-pyoidc~=3.7.0
55
Flask~=1.1.4
6-
csh_ldap~=2.4.0
6+
csh-ldap @ git+https://github.com/costowell/csh_ldap@67dd183744746c758d6c13878f539437d2628b63
77
ddtrace==3.12.2
88
flask_sqlalchemy~=2.5.1
99
gunicorn~=20.0.4

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ click==7.1.2
2828
# pip-tools
2929
cryptography==45.0.6
3030
# via oic
31-
csh-ldap==2.4.0
31+
csh-ldap @ git+https://github.com/costowell/csh_ldap@67dd183744746c758d6c13878f539437d2628b63
3232
# via -r requirements.in
3333
ddtrace==3.12.2
3434
# via -r requirements.in
@@ -141,7 +141,7 @@ pylint-quotes==0.2.3
141141
# via -r requirements.in
142142
python-dotenv==1.1.1
143143
# via pydantic-settings
144-
python-ldap==3.4.0
144+
python-ldap==3.4.4
145145
# via csh-ldap
146146
requests==2.32.5
147147
# via

0 commit comments

Comments
 (0)