Skip to content

Commit 9b06ae4

Browse files
committed
add bento, fix a few bugs it found
1 parent f3a49a2 commit 9b06ae4

File tree

8 files changed

+157
-6
lines changed

8 files changed

+157
-6
lines changed

.bento.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
formatter:
2+
- clippy: {}
3+
- histo: {}
4+
tools:
5+
r2c.bandit:
6+
ignore:
7+
- B101
8+
- B104
9+
- B105
10+
- B106
11+
- B107
12+
- B108
13+
- B112
14+
- B303
15+
- B310
16+
- B311
17+
- B403
18+
- B404
19+
- B405
20+
- B406
21+
- B407
22+
- B408
23+
- B409
24+
- B410
25+
- B603
26+
- B604
27+
- B606
28+
- B607
29+
- B608
30+
r2c.flake8:
31+
ignore:
32+
- A003
33+
- E117
34+
- E127
35+
- E122
36+
- E252
37+
- E123
38+
- F401
39+
- E224
40+
- E742
41+
- E115
42+
- E131
43+
- E743
44+
- E116
45+
- E266
46+
- E231
47+
- E201
48+
- E713
49+
- E401
50+
- E221
51+
- E731
52+
- E121
53+
- E502
54+
- E305
55+
- B010
56+
- E275
57+
- E222
58+
- E301
59+
- E251
60+
- E402
61+
- E303
62+
- B001
63+
- W391
64+
- E712
65+
- F406
66+
- E261
67+
- E228
68+
- E223
69+
- E133
70+
- E242
71+
- E304
72+
- E302
73+
- E227
74+
- E128
75+
- E704
76+
- E211
77+
- E274
78+
- E225
79+
- E702
80+
- W291
81+
- W504
82+
- E703
83+
- E226
84+
- E241
85+
- E111
86+
- E202
87+
- E129
88+
- E306
89+
- B009
90+
- E101
91+
- E501
92+
- E714
93+
- W293
94+
- E265
95+
- E114
96+
- E741
97+
- E125
98+
- E126
99+
- E262
100+
- E721
101+
- W191
102+
- E203
103+
- E701
104+
- W503
105+
- E273
106+
- E711
107+
- W292
108+
- E124
109+
- E271
110+
- E272
111+
r2c.flask:
112+
ignore: []
113+
r2c.requests:
114+
ignore: []

.bentoignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Items added to this file will be ignored by bento.
2+
#
3+
# This file uses .gitignore syntax:
4+
#
5+
# To ignore a file anywhere it occurs in your project, enter a
6+
# glob pattern here. E.g. "*.min.js".
7+
#
8+
# To ignore a directory anywhere it occurs in your project, add
9+
# a trailing slash to the file name. E.g. "dist/".
10+
#
11+
# To ignore a file or directory only relative to the project root,
12+
# include a slash anywhere except the last character. E.g.
13+
# "/dist/", or "src/generated".
14+
#
15+
# Some parts of .gitignore syntax are not supported, and patterns
16+
# using this syntax will be dropped from the ignore list:
17+
# - Explicit "include syntax", e.g. "!kept/".
18+
# - Multi-character expansion syntax, e.g. "*.py[cod]"
19+
#
20+
# To include ignore patterns from another file, start a line
21+
# with ':include', followed by the path of the file. E.g.
22+
# ":include path/to/other/ignore/file".
23+
#
24+
# To ignore a file with a literal ':' character, escape it with
25+
# a backslash, e.g. "\:foo".
26+
27+
# Ignore Bento environment files
28+
.bento/
29+
30+
# Ignore git items
31+
.gitignore
32+
.git/
33+
:include .gitignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ instance/uploads
1616
.coverage
1717
cover
1818
.coveralls.yml
19+
20+
# Ignore bento tool run paths (this line added by `bento init`)
21+
.bento/

call_server/api/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def campaign_target_calls(campaign_id):
357357
except AttributeError:
358358
current_app.logger.error('unable to adapt target_data for %s: %s' % (target_uid, target_data))
359359
else:
360-
current_app.logger.error('no target_data for %s: %s' % (target_uid, e))
360+
current_app.logger.error('no target_data for %s' % target_uid)
361361

362362
if adapted_data:
363363
targets[target_uid]['title'] = adapted_data.get('title')

call_server/jinja.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def leave_tag(self, tag, ctx):
8282
return
8383
for idx, other_tag in enumerate(reversed(ctx.stack)):
8484
if other_tag == tag:
85-
for num in xrange(idx + 1):
85+
for num in range(idx + 1):
8686
ctx.stack.pop()
8787
elif not self.breaking_rules.get(other_tag):
8888
break

call_server/schedule/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class ScheduleCall(db.Model):
2727

2828
job_id = db.Column(db.String(36)) # UUID4
2929

30-
def __init__(self, campaign_id, phone_number, time=utc_now().time()):
30+
def __init__(self, campaign_id, phone_number, time):
3131
self.created_at = utc_now()
3232
self.campaign_id = campaign_id
3333
self.phone_number = phone_number
34-
self.time_to_call = time
34+
self.time_to_call = time or utc_now().time()
3535

3636
def __repr__(self):
3737
return u'<ScheduleCall for {} to {}>'.format(self.campaign.name, self.phone_number.e164)

call_server/sync/integrations/actionkit_crm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _match_ak_target_data(self, campaign, target):
4848
if campaign.country_code.upper() == 'US':
4949
# look up target in political_data
5050
data_provider = campaign.get_country_data()
51-
target_data = data_provider.cache_get(target_key)
51+
target_data = data_provider.cache_get(target.key)
5252

5353
if campaign.campaign_type == 'congress':
5454
target_state = target_data.get('state', '')

call_server/user/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime
2+
import functools
23

34
from sqlalchemy_utils.types import phone_number
45
from werkzeug import generate_password_hash, check_password_hash
@@ -87,7 +88,7 @@ def search(cls, keywords):
8788
User.name.ilike(keyword),
8889
User.email.ilike(keyword),
8990
))
90-
q = reduce(db.and_, criteria)
91+
q = functools.reduce(db.and_, criteria)
9192
return cls.query.filter(q)
9293

9394
@classmethod

0 commit comments

Comments
 (0)