Open 1letter opened 5 months ago
@gforcada i can't create a PR in this repro. i have tested the multiline single quotes locally. the error is gone. but i didn't investigate site effects of my change. on the first view, only the relevant changes in then configfiles happen.
I changed in toml_encoder.py
only the dump_string
function.
import toml
def dump_string(value):
if "\n" in value:
# Return a multi line string as a multi line string,
# instead of on one line with literal '\n' in it.
return f"'''\n{value}'''"
return toml.encoder._dump_str(value)
class TomlArraySeparatorEncoderWithNewline(toml.TomlArraySeparatorEncoder):
"""Special version indenting the first element of and array.
In https://github.com/zopefoundation/meta/issues/118 we suggest to switch
to Python 3.11 and its built-in toml support. We'll see if this path is
still needed then.
"""
def __init__(self, _dict=dict, preserve=False, separator=",",
indent_first_line=False):
super(TomlArraySeparatorEncoderWithNewline, self).__init__(
_dict=_dict, preserve=preserve, separator=separator)
self.indent_first_line = indent_first_line
self.dump_funcs[str] = dump_string
def dump_list(self, v):
t = []
retval = "["
if self.indent_first_line:
retval += self.separator.strip(',')
for u in v:
t.append(self.dump_value(u))
while t != []:
s = []
for u in t:
if isinstance(u, list):
for r in u:
s.append(r)
else:
retval += " " + u + self.separator
t = s
retval += " ]"
return retval
@gforcada why can't i create an PR in this repro? i filled out the plone contributor agreement or is this a special package?
@1letter hey, sorry for the long delay, I'm a bit over my capacity as of late 😵💫
As for not being able to create PRs here... let me have a look, I certainly did not make plone/meta
special (at least that I remember).
Turns out that only the @plone/ci-team is able to create PRs here, not sure who decided that 🤷🏾
You can still fork the project and make the changes there, and point here to the branch, then I(?) can create the PR on your behalf? Would that be reasonable? at least for this one to not get blocked...
More on the subject of the issue: I kind of remember that on zopefoundation/meta
they were arguing about updating the toml
library being used, maybe they have some other goodies/updates there that might be worth porting over here? 🤔
Not sure, but it looks that regex expressions not right parsed/evaluated by meta package.
in the .meta.toml of
my.addon
file exists the following section:if i escape the backslashes in the coverage rule, no effect, same error happens
Looks like the same error in #223
Perhaps a multiline literal string with three single quotes help? See https://toml.io/en/v1.0.0#string