Skip to content

Commit 1be8b23

Browse files
committed
Merge pull request #2417 from hypothesis/prospector-allow-id-as-valid-name
Fix pylint warnings about `id` name
2 parents 3920527 + 4ee277e commit 1be8b23

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.prospector.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ pylint:
2525
#
2626
# - log: common in "log = logging.getLogger(__name__)" pattern
2727
# - parser: common in modules that use argparse
28+
# - id: Commonly used as a class attribute / database column name in
29+
# sqlalchemy model classes. Note that if you use id as the name of
30+
# a local variable or parameter, pylint will still complain that
31+
# you're shadowing the builtin.
2832
#
29-
good-names: _,i,j,k,v,e,db,fn,fp,log,parser
33+
good-names: _,i,j,k,v,e,db,fn,fp,log,parser,id
3034
pep257:
3135
disable:
3236
- D100 # Missing docstring in public module

h/api/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def update(context, request):
186186
def delete(context, request):
187187
"""Delete the annotation permanently."""
188188
annotation = context
189-
id = annotation['id']
189+
id_ = annotation['id']
190190
# Delete the annotation from the database.
191191
annotation.delete()
192192

@@ -195,7 +195,7 @@ def delete(context, request):
195195

196196
# Return a confirmation
197197
return {
198-
'id': id,
198+
'id': id_,
199199
'deleted': True,
200200
}
201201

h/notification/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class Subscriptions(Base):
1515
active = sa.Column(sa.BOOLEAN, default=True, nullable=False)
1616

1717
@classmethod
18-
def get_by_id(cls, id):
18+
def get_by_id(cls, id_):
1919
"""Get a subscription by its primary key."""
20-
return cls.query.filter(cls.id == id).first()
20+
return cls.query.filter(cls.id == id_).first()
2121

2222
@classmethod
2323
def get_active_subscriptions_for_a_type(cls, ttype):

0 commit comments

Comments
 (0)