reports: Fix mypy errors.
Errors were: conservancy_beancount/reports/core.py:923: error: Generator has incompatible item type "Optional[str]"; expected "str" conservancy_beancount/reports/core.py:929: error: Item "None" of "Optional[str]" has no attribute "lower" conservancy_beancount/reports/ledger.py:534: error: Item "None" of "Optional[str]" has no attribute "partition" conservancy_beancount/reports/ledger.py:729: error: Item "None" of "Optional[str]" has no attribute "lower" conservancy_beancount/reports/rewrite.py:563: error: Argument 2 to "_iter_yaml" of "RewriteRuleset" has incompatible type "Union[Any, str, None]"; expected "str"
This commit is contained in:
parent
0342c5b83e
commit
7783f7ad10
3 changed files with 5 additions and 5 deletions
|
@ -920,13 +920,13 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
|
||||||
if not flags:
|
if not flags:
|
||||||
raise ValueError(f"no valid edges in {edges!r}")
|
raise ValueError(f"no valid edges in {edges!r}")
|
||||||
border_attr = f'{width} {style} {color}'
|
border_attr = f'{width} {style} {color}'
|
||||||
key = f'{",".join(f.name for f in flags)} {border_attr}'
|
key = f'{",".join(str(f.name) for f in flags)} {border_attr}'
|
||||||
try:
|
try:
|
||||||
retval = self._style_cache[key]
|
retval = self._style_cache[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
props = odf.style.TableCellProperties()
|
props = odf.style.TableCellProperties()
|
||||||
for flag in flags:
|
for flag in flags:
|
||||||
props.setAttribute(f'border{flag.name.lower()}', border_attr)
|
props.setAttribute(f'border{str(flag.name).lower()}', border_attr)
|
||||||
retval = odf.style.Style(
|
retval = odf.style.Style(
|
||||||
name=f'Border{next(self._name_counter)}',
|
name=f'Border{next(self._name_counter)}',
|
||||||
family='table-cell',
|
family='table-cell',
|
||||||
|
|
|
@ -531,7 +531,7 @@ class ReportType(enum.IntFlag):
|
||||||
return cls.DEBIT_TRANSACTIONS
|
return cls.DEBIT_TRANSACTIONS
|
||||||
|
|
||||||
def _choices_sortkey(self) -> Sortable:
|
def _choices_sortkey(self) -> Sortable:
|
||||||
subtype, _, maintype = self.name.partition('_')
|
subtype, _, maintype = str(self.name).partition('_')
|
||||||
return (maintype, subtype)
|
return (maintype, subtype)
|
||||||
|
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ date was also not specified.
|
||||||
type=report_type.enum_type,
|
type=report_type.enum_type,
|
||||||
default=report_type_default,
|
default=report_type_default,
|
||||||
help=f"""The type of report to generate. Choices are
|
help=f"""The type of report to generate. Choices are
|
||||||
{report_type.choices_str()}. Default is {report_type_default.name.lower()!r}.
|
{report_type.choices_str()}. Default is {str(report_type_default.name).lower()!r}.
|
||||||
""")
|
""")
|
||||||
# --transactions got merged into --report-type; this is backwards compatibility.
|
# --transactions got merged into --report-type; this is backwards compatibility.
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
|
@ -553,7 +553,7 @@ class RewriteRuleset:
|
||||||
if isinstance(source, str):
|
if isinstance(source, str):
|
||||||
name = '<string>'
|
name = '<string>'
|
||||||
else:
|
else:
|
||||||
name = getattr(source, 'name', '<file>')
|
name = str(getattr(source, 'name', '<file>'))
|
||||||
try:
|
try:
|
||||||
doc = yaml.safe_load(source)
|
doc = yaml.safe_load(source)
|
||||||
except yaml.error.YAMLError as error:
|
except yaml.error.YAMLError as error:
|
||||||
|
|
Loading…
Reference in a new issue