From 548496320020be6399970e9563e64abb6287fb8f Mon Sep 17 00:00:00 2001 From: Lev Gorodetskiy Date: Wed, 7 Jul 2021 10:00:37 +0300 Subject: [PATCH 1/2] Add `# dipdup: ignore` at the beginning of type module to ignore it on init --- src/dipdup/codegen.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dipdup/codegen.py b/src/dipdup/codegen.py index a5896d74a..ce60a7437 100644 --- a/src/dipdup/codegen.py +++ b/src/dipdup/codegen.py @@ -237,6 +237,12 @@ async def generate_types(self) -> None: input_path = join(root, file) output_path = join(types_root, f'{pascal_to_snake(name)}.py') + if exists(output_path): + with open(output_path) as type_file: + first_line = type_file.readline() + if first_line == '# dipdup: ignore\n': + continue + if name == 'storage': name = '_'.join([root.split('/')[-1], name]) if root.split('/')[-1] == 'parameter': From d689aaa4baa32760d5d17c9a2b6dfad35bee8c4d Mon Sep 17 00:00:00 2001 From: Lev Gorodetskiy Date: Wed, 7 Jul 2021 17:49:02 +0300 Subject: [PATCH 2/2] dipdup ignore regex --- src/dipdup/codegen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dipdup/codegen.py b/src/dipdup/codegen.py index ce60a7437..9b5817968 100644 --- a/src/dipdup/codegen.py +++ b/src/dipdup/codegen.py @@ -1,6 +1,7 @@ import json import logging import os +import re import subprocess from contextlib import suppress from copy import copy @@ -240,7 +241,7 @@ async def generate_types(self) -> None: if exists(output_path): with open(output_path) as type_file: first_line = type_file.readline() - if first_line == '# dipdup: ignore\n': + if re.match(r'^#\s+dipdup:\s+ignore\s*', first_line): continue if name == 'storage':