Skip to content

Commit

Permalink
Fix two undefined names in phototemplate.py (#1030)
Browse files Browse the repository at this point in the history
* Fix two undefined names in phototemplate.py

% `ruff --exit-zero --select=E9,F63,F7,F82,YTT .`
```
osxphotos/cli/report_writer.py:22:1: F822 Undefined name `ExportReportWriterSqlite` in `__all__`
osxphotos/cli/report_writer.py:22:1: F822 Undefined name `SyncReportWriterSqlite` in `__all__`
osxphotos/phototemplate.py:1156:108: F821 Undefined name `vals`
osxphotos/phototemplate.py:1685:29: F821 Undefined name `PhotoInfo`
Found 4 errors.
```

* Avoid cyclic imports
  • Loading branch information
cclauss committed Apr 3, 2023
1 parent 8b59615 commit 3ddfea6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions osxphotos/phototemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ def comparison_test(test_function):
)
except ValueError as e:
raise SyntaxError(
f"comparison operators may only be used with values that can be converted to numbers: {vals} {conditional_value}"
f"comparison operators may only be used with values that can be converted to numbers: {value} {conditional_value}"
) from e

predicate_is_true = False
Expand Down Expand Up @@ -1682,7 +1682,7 @@ def format_date_field(dt: datetime.datetime, field: str, args: List[str]) -> str
raise ValueError(f"Unhandled template value: {field}") from e


def get_place_value(photo: "PhotoInfo", field: str):
def get_place_value(photo: "PhotoInfo", field: str): # noqa: F821
"""Get the value of a 'place' field by attribute
Args:
Expand Down

0 comments on commit 3ddfea6

Please sign in to comment.