mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-30 19:29:43 -04:00
fix linter errors
This commit is contained in:
@@ -506,7 +506,7 @@ class ServiceSmsSender(Form):
|
||||
]
|
||||
)
|
||||
|
||||
def validate_sms_sender(form, field):
|
||||
def validate_sms_sender(self, field):
|
||||
if field.data and not re.match(r'^[a-zA-Z0-9\s]+$', field.data):
|
||||
raise ValidationError('Use letters and numbers only')
|
||||
|
||||
@@ -520,7 +520,7 @@ class ServiceLetterContactBlockForm(Form):
|
||||
)
|
||||
is_default = BooleanField("Set as your default address")
|
||||
|
||||
def validate_letter_contact_block(form, field):
|
||||
def validate_letter_contact_block(self, field):
|
||||
line_count = field.data.strip().count('\n')
|
||||
if line_count >= 10:
|
||||
raise ValidationError(
|
||||
|
||||
@@ -80,7 +80,7 @@ def template_history(service_id):
|
||||
|
||||
months = [
|
||||
{
|
||||
'name': YYYY_MM_to_datetime(month).strftime('%B'),
|
||||
'name': yyyy_mm_to_datetime(month).strftime('%B'),
|
||||
'templates_used': aggregate_usage(
|
||||
format_template_stats_to_list(stats.get(month)), sort_key='requested_count'
|
||||
),
|
||||
@@ -310,14 +310,14 @@ def format_monthly_stats_to_list(historical_stats):
|
||||
return sorted((
|
||||
dict(
|
||||
date=key,
|
||||
future=YYYY_MM_to_datetime(key) > datetime.utcnow(),
|
||||
name=YYYY_MM_to_datetime(key).strftime('%B'),
|
||||
future=yyyy_mm_to_datetime(key) > datetime.utcnow(),
|
||||
name=yyyy_mm_to_datetime(key).strftime('%B'),
|
||||
**aggregate_status_types(value)
|
||||
) for key, value in historical_stats.items()
|
||||
), key=lambda x: x['date'])
|
||||
|
||||
|
||||
def YYYY_MM_to_datetime(string):
|
||||
def yyyy_mm_to_datetime(string):
|
||||
return datetime(int(string[0:4]), int(string[5:7]), 1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user