Whole file

kellyjonbrazil/jello

The author described this change as move hasattr __self__ check inside pyquery() and raise a ValueError instead of sys.exit() in main(). It counts as a record because the check below fails on the code as it stood at 16bc7b1b1 and passes on 300f67690, with nothing else changed between the two runs.

Fix saved2021-06-10
Sharing licenceMIT · LICENSE
Change size+5 9

What the code was meant to do, written into the code itself as a save note

move hasattr __self__ check inside pyquery() and raise a ValueError instead of sys.exit() in main()

The change

409409 elif isinstance(output, DotMap):
410410 output = output.toDict()
411411
412+ # if DotMap returns a bound function then we know it was a reserved attribute name
413+ if hasattr(output, '__self__'):
414+ raise ValueError('A reserved key name with dotted notation was used in the query. Please use python bracket dict notation to access this key.')
415+
412416 return output
413417
414418
541545 except Exception as e:
542546 query = query.replace('\n', '; ')
543547
548+ err_data = ''
544549 if len(str(list_dict_data)) > 70:
545550 err_data = str(list_dict_data)[0:35] + ' ... ' + str(list_dict_data)[-35:-1]
546551
555560 query: {query}
556561 data: {err_data}
557562 response: {response}
558- '''))
559-
560- # if DotMap returns a bound function then we know it was a reserved attribute name
561- if hasattr(response, '__self__'):
562- print_error(textwrap.dedent(f'''\
563- jello: A reserved key name with dotted notation was used in the query.
564- Please use python bracket dict notation to access this key.
565-
566- query: {query}
567563 '''))
568564
569565 set_env_colors()

The check that tells the two apart

failpass·tests/test_pyquery.py::MyTests::test_ValueError

Check file tests/test_pyquery.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it16bc7b1b1e82bcd25e51e99300b61f797f6579c0
Broken version dated2021-06-10
Modulejello.cli
Units changedmain, pyquery
Fingerprintd9fea647e621ad12
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in kellyjonbrazil/jello