Skip to content

Commit 5939323

Browse files
committed
1.2.4 - Minor improvements in generated goodies
* Removed annoying warning message when loading goodies * Removed useless try/except for goodies that do not need import
1 parent b26d3e2 commit 5939323

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

code_generation/goodies_template.mako

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,47 @@
22
# This file is generated by mini_lambda_methods_generation.py - do not modify it !
33
# ----
44
from mini_lambda.main import C, make_lambda_friendly_class, make_lambda_friendly_method
5-
from warnings import warn
5+
# from warnings import warn
66

77
% for o in import_lines:
88
${o}
99
% endfor
1010

1111
% for o in to_create:
12+
% if o.import_line is None or len(o.import_line) == 0:
13+
% if o.constant_name:
14+
## CONSTANT
15+
${o.item_name} = C(${o.constant_name}, '${o.constant_name}')
16+
% elif o.function_name:
17+
## FUNCTION (except Format)
18+
% if o.function_name != 'Format':
19+
${o.item_name} = make_lambda_friendly_method(${o.function_name}, '${o.function_name}')
20+
% endif
21+
% else:
22+
## CLASS
23+
${o.item_name} = make_lambda_friendly_class(${o.class_name})
24+
% endif
25+
% else:
1226
try:
1327
## IMPORT
1428
${o.import_line}
15-
% if o.constant_name:
16-
## CONSTANT
29+
% if o.constant_name:
30+
## CONSTANT
1731
${o.item_name} = C(${o.constant_name}, '${o.constant_name}')
18-
% elif o.function_name:
19-
% if o.function_name != 'Format':
20-
## FUNCTION
32+
% elif o.function_name:
33+
## FUNCTION (except Format)
34+
% if o.function_name != 'Format':
2135
${o.item_name} = make_lambda_friendly_method(${o.function_name}, '${o.function_name}')
22-
% endif
23-
% else:
24-
## CLASS
36+
% endif
37+
% else:
38+
## CLASS
2539
${o.item_name} = make_lambda_friendly_class(${o.class_name})
26-
% endif
40+
% endif
2741
except ImportError as e:
28-
warn("Error performing '${o.import_line}': " + str(e))
42+
# new: silently escape, as this is annoying
43+
# warn("Error performing '${o.import_line}': " + str(e))
44+
pass
45+
% endif
2946

3047

3148
% endfor

docs/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### 1.2.4 - Minor improvements in generated goodies
2+
3+
* Removed annoying warning message when loading goodies
4+
* Removed useless try/except for goodies that do not need import
5+
16
### 1.2.3 - Fixed minor bug in code generation
27

38
* Removed all `None` that were appearing in the goodies_generated.py file

0 commit comments

Comments
 (0)