Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBformatter.re doesn't work with double-braces #125

Open
jtniehof opened this issue Feb 14, 2022 · 0 comments
Open

DBformatter.re doesn't work with double-braces #125

jtniehof opened this issue Feb 14, 2022 · 0 comments
Labels

Comments

@jtniehof
Copy link
Member

The DBformatter.re method doesn't work with double-braces (i.e., "do not expand this").

This is documented but someone might reasonably expect to, say, include these to allow curly-braces in their configuration files and be surprised by it.

Minimal example to reproduce issue:

import dbprocessing.DBstrings
fmtr = dbprocessing.DBstrings.DBformatter()
fmtr.re('{{Y}}')  # should return '{Y}'

Error message/Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jtniehof/.local//lib//python3.6/site-packages/dbprocessing/DBstrings.py", line 93, in re
    self.expand_format(format_string, kwargs), *args, **kwargs)
  File "/usr/lib/python3.6/string.py", line 190, in format
    return self.vformat(format_string, args, kwargs)
  File "/usr/lib/python3.6/string.py", line 194, in vformat
    result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
  File "/usr/lib/python3.6/string.py", line 234, in _vformat
    obj, arg_used = self.get_field(field_name, args, kwargs)
  File "/usr/lib/python3.6/string.py", line 299, in get_field
    obj = self.get_value(first, args, kwargs)
  File "/usr/lib/python3.6/string.py", line 256, in get_value
    return kwargs[key]
KeyError: 'Y'

OS, Python version, and dependency version information:

Linux-4.15.0-167-generic-x86_64-with-Ubuntu-18.04-bionic
sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
sqlalchemy=1.1.11

Version of dbprocessing

Current git master (5acdfa8)

Closure condition

This issue should be closed when a test for double-braces is committed with code that makes it pass.

@jtniehof jtniehof added the bug label Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant