accrual: Clean up comments.

This commit is contained in:
Brett Smith 2020-06-12 13:59:38 -04:00
parent 5706273bbe
commit 2a33e17892

View file

@ -178,8 +178,6 @@ class AccrualPostings(core.RelatedPostings):
_can_own: bool=False, _can_own: bool=False,
) -> None: ) -> None:
super().__init__(source, _can_own=_can_own) super().__init__(source, _can_own=_can_own)
# The following type declarations tell mypy about values set in the for
# loop that are important enough to be referenced directly elsewhere.
self.account = self._single_item(post.account for post in self) self.account = self._single_item(post.account for post in self)
if isinstance(self.account, Sentinel): if isinstance(self.account, Sentinel):
self.accrual_type: Optional[AccrualAccount] = None self.accrual_type: Optional[AccrualAccount] = None
@ -218,9 +216,7 @@ class AccrualPostings(core.RelatedPostings):
# value like "FIXME". It can be refined if needed. # value like "FIXME". It can be refined if needed.
invoice_ok = isinstance(self.invoice, str) and '/' in self.invoice invoice_ok = isinstance(self.invoice, str) and '/' in self.invoice
if account_ok and entity_ok and invoice_ok: if account_ok and entity_ok and invoice_ok:
# mypy loses track of the fact that self.invoice must be a str in # type ignore for <https://github.com/python/mypy/issues/6670>
# this case (gated on the invoice_ok boolean) and complains it
# doesn't match the type of the return value.
yield (self.invoice, self) # type:ignore[misc] yield (self.invoice, self) # type:ignore[misc]
return return
groups = collections.defaultdict(list) groups = collections.defaultdict(list)