Remove some unnecessary empty lines from generated .py file

This commit is contained in:
William S Fulton 2022-04-06 23:49:59 +01:00
commit fe0af80933

View file

@ -876,8 +876,10 @@ public:
Printv(f_shadow_py, default_import_code, NIL); Printv(f_shadow_py, default_import_code, NIL);
} }
Printv(f_shadow_py, "\n", f_shadow, "\n", NIL); if (Len(f_shadow) > 0)
Printv(f_shadow_py, f_shadow_stubs, "\n", NIL); Printv(f_shadow_py, "\n", f_shadow, "\n", NIL);
if (Len(f_shadow_stubs) > 0)
Printv(f_shadow_py, f_shadow_stubs, "\n", NIL);
Delete(f_shadow_py); Delete(f_shadow_py);
} }
@ -2635,7 +2637,7 @@ public:
add_method(symname, wname, 0, p); add_method(symname, wname, 0, p);
/* Create a shadow for this function (if enabled and not in a member function) */ /* Create a shadow for this function (if enabled and not in a member function) */
if (!builtin && shadow && (!(shadow & PYSHADOW_MEMBER)) && use_static_method) { if (!builtin && shadow && !(shadow & PYSHADOW_MEMBER) && use_static_method) {
emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, symname, 0); emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, symname, 0);
} }
DelWrapper(f); DelWrapper(f);
@ -3309,9 +3311,10 @@ public:
add_method(iname, wname, allow_kwargs, n, funpack, num_required, num_arguments); add_method(iname, wname, allow_kwargs, n, funpack, num_required, num_arguments);
/* Create a shadow for this function (if enabled and not in a member function) */ /* Create a shadow for this function (if enabled and not in a member function) */
if (!builtin && shadow && (!(shadow & PYSHADOW_MEMBER)) && use_static_method) { if (!builtin && shadow && !(shadow & PYSHADOW_MEMBER) && use_static_method) {
emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, iname, allow_kwargs); emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, iname, allow_kwargs);
} }
} else { } else {
if (!Getattr(n, "sym:nextSibling")) { if (!Getattr(n, "sym:nextSibling")) {
dispatchFunction(n, linkage, funpack, builtin_self, builtin_ctor, director_class, use_static_method); dispatchFunction(n, linkage, funpack, builtin_self, builtin_ctor, director_class, use_static_method);
@ -3470,7 +3473,7 @@ public:
if (builtin) if (builtin)
Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", global_name); Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", global_name);
have_globals = 1; have_globals = 1;
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER))) { if (!builtin && shadow && !(shadow & PYSHADOW_MEMBER)) {
Printf(f_shadow_stubs, "%s = %s.%s\n", global_name, module, global_name); Printf(f_shadow_stubs, "%s = %s.%s\n", global_name, module, global_name);
} }
} }
@ -3628,7 +3631,7 @@ public:
if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) {
Replaceall(tm, "$value", value); Replaceall(tm, "$value", value);
if (needs_swigconstant(n) && !builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (!in_class || !Getattr(n, "feature:python:callback"))) { if (needs_swigconstant(n) && !builtin && shadow && !(shadow & PYSHADOW_MEMBER) && (!in_class || !Getattr(n, "feature:python:callback"))) {
// Generate `*_swigconstant()` method which registers the new constant. // Generate `*_swigconstant()` method which registers the new constant.
// //
// *_swigconstant methods are required for constants of class type. // *_swigconstant methods are required for constants of class type.
@ -3666,7 +3669,7 @@ public:
return SWIG_NOWRAP; return SWIG_NOWRAP;
} }
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER))) { if (!builtin && shadow && !(shadow & PYSHADOW_MEMBER)) {
String *f_s; String *f_s;
if (!in_class) { if (!in_class) {
f_s = f_shadow; f_s = f_shadow;
@ -4617,7 +4620,8 @@ public:
} }
shadow_indent = 0; shadow_indent = 0;
Printf(f_shadow_file, "%s\n", f_shadow_stubs); if (Len(f_shadow_stubs) > 0)
Printf(f_shadow_file, "%s\n", f_shadow_stubs);
Clear(f_shadow_stubs); Clear(f_shadow_stubs);
} }