Closed raffaem closed 7 months ago
It is difficult to say without seeing the code. Having said, the documentation you refer to simply seems to be an artifact of old documentation and indeed should be updated.
The code is this.
It also starts to log from the second call onwards for some reason:
➜ python
Python 3.12.0 (main, Nov 10 2023, 22:38:47) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.INFO, force=True)
>>> from polyfuzz import PolyFuzz
>>> model = PolyFuzz("EditDistance")
>>> model.match(["hello"], ["hi"])
<polyfuzz.polyfuzz.PolyFuzz object at 0x7f20b4232b10>
>>> model.match(["hello"], ["hi"])
INFO:root:Ran model with model id = None
<polyfuzz.polyfuzz.PolyFuzz object at 0x7f20b4232b10>
>>> model.match(["hello"], ["hi"])
INFO:root:Ran model with model id = None
<polyfuzz.polyfuzz.PolyFuzz object at 0x7f20b4232b10>
I think I have installed from pip, which don't have https://github.com/MaartenGr/PolyFuzz/commit/e7540030d6dddc64bdb94c474ed6360dd7a5cdf7
Thanks for sharing, I can only reproduce this issue with the following added:
import logging
logging.basicConfig(level=logging.INFO, force=True)
Which is not supported behavior for PolyFuzz. To work with the verbosity, use the verbose
parameter instead.
The behavior of initializing a logger before loading polyfuzz is fully supported as it must be.
How am I supposed to log my own logs otherwise?
The verbose
parameter is False by default, and logs only warnings by default.
As stated the problem was that I installed from pypi, which didn't include https://github.com/MaartenGr/PolyFuzz/commit/e7540030d6dddc64bdb94c474ed6360dd7a5cdf7.
Thus it logs to the root logger (by calling logging
directly) instead of the instantiated logger
, bypassing the log level set by the verbose
parameter (logging.WARNING
), and using the default loglevel which is logging.INFO
.
Ah right, thanks! Then I'll close the issue.
I keep getting "Ran model with model id = None" logs.
And I don't understand why in the examples there is a
model_id
passed to the constructor ofPolyFuzz
while this constructor do not take this argument