Skip to content

Commit 700a3ba

Browse files
Better PEP 8 compatibility of generated callbacks (#532)
1 parent 4a73d3a commit 700a3ba

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
1515

1616
### Fixed
1717

18+
- codegen: Better PEP 8 compatibility of generated callbacks.
1819
- cli: Fixed missing log messages from `ctx.logger`.
1920
- cli: Configure package logger in addition to `dipdup` one.
2021
- context: Fixed `execute_sql` method crashes when the path is a file.

src/dipdup/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ async def _generate_callback(self, callback_config: CallbackMixin, sql: bool = F
417417
callback_code = callback_template.render(
418418
callback=callback,
419419
arguments=tuple(dict.fromkeys(arguments)),
420-
imports=tuple(dict.fromkeys(imports)),
420+
imports=sorted(dict.fromkeys(imports)),
421421
code=code,
422422
)
423423
write(callback_path, callback_code)

src/dipdup/templates/callback.py.j2

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
{%- for imp in imports %}
2-
{{ imp }}
3-
{%- endfor %}
1+
{% for imp in imports %}{{ imp }}
2+
{% endfor %}
43

54
async def {{ callback }}(
65
{%- for arg in arguments %}

0 commit comments

Comments
 (0)