[py3] Convert filter object to list (#15260)

This commit is contained in:
Shreya Shah 2018-08-30 19:22:22 +05:30 committed by Nabin Hait
parent 91ac26c2ff
commit ee8f8281b4
4 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,7 @@ def upload():
from frappe.modules import scrub from frappe.modules import scrub
rows = read_csv_content_from_uploaded_file() rows = read_csv_content_from_uploaded_file()
rows = filter(lambda x: x and any(x), rows) rows = list(filter(lambda x: x and any(x), rows))
if not rows: if not rows:
msg = [_("Please select a csv file")] msg = [_("Please select a csv file")]
return {"messages": msg, "error": msg} return {"messages": msg, "error": msg}

View File

@ -45,8 +45,8 @@ class EmailDigest(Document):
# send email only to enabled users # send email only to enabled users
valid_users = [p[0] for p in frappe.db.sql("""select name from `tabUser` valid_users = [p[0] for p in frappe.db.sql("""select name from `tabUser`
where enabled=1""")] where enabled=1""")]
recipients = filter(lambda r: r in valid_users, recipients = list(filter(lambda r: r in valid_users,
self.recipient_list.split("\n")) self.recipient_list.split("\n")))
original_user = frappe.session.user original_user = frappe.session.user

View File

@ -49,7 +49,7 @@ class NamingSeries(Document):
} }
def scrub_options_list(self, ol): def scrub_options_list(self, ol):
options = filter(lambda x: x, [cstr(n).strip() for n in ol]) options = list(filter(lambda x: x, [cstr(n).strip() for n in ol]))
return options return options
def update_series(self, arg=None): def update_series(self, arg=None):

View File

@ -61,7 +61,7 @@ class StockReconciliation(StockController):
- flt(qty, item.precision("qty")) * flt(rate, item.precision("valuation_rate"))) - flt(qty, item.precision("qty")) * flt(rate, item.precision("valuation_rate")))
return True return True
items = filter(lambda d: _changed(d), self.items) items = list(filter(lambda d: _changed(d), self.items))
if not items: if not items:
frappe.throw(_("None of the items have any change in quantity or value."), frappe.throw(_("None of the items have any change in quantity or value."),