-
Notifications
You must be signed in to change notification settings - Fork 68
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
add a new graph
cached attribute to the Bot
object
#792
Conversation
... it holds a networkx graph representation of the maze. The graph was before manually generated using the walls_to_graph function in utils.py
Should we have a deprecated decorator on Should we use the frozen graph then? It doesn’t help much but at least it signals ‘do not touch’. |
Not sure it makes sense to have the deprecated decorator. New code will not use the old function. Old code is not going to be updated by anyone, so the deprecation won't motivate anyone to update the code. In my opinion we can leave the import there for an indefinite time.
Before merging I want to add some tests to be sure that if a bot changes the graph right now those changes are indeed lost. I am not sure given the way the caching is implemented. Sorry, I didn't think of it when I submitted the PR, otherwise I would have put the WIP label...
We can then use the frozen decorator then, which should pass the still-to-be-written tests, in case the current implementation is indeed broken.
…On Wed 15 May, 07:08 +0000, Rike-Benjamin Schuppner ***@***.***> wrote:
Should we have a deprecated decorator on `utils.walls_to_graph`? At some point we should surely decide on one import only.
Should we use the frozen graph then? It doesn’t help much but at least it signals ‘do not touch’.
—
Reply to this email directly, view it on GitHub¹, or unsubscribe².
You are receiving this because you authored the thread.☘Message ID: ***@***.***>
––––
¹ #792 (comment)
² https://github.com/notifications/unsubscribe-auth/AACUYC4UBHUZJYSAE2XWV2TZCNT6VAVCNFSM6AAAAABHX4IJ5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJSGY2TGNRYHE
|
Ok but if we keep the import around then we should still flag it so that is is not removed by some import checker. Or remove it now and live with the consequences. |
The graph is now a read-only view and tests have been added. Ready to merge on my side. |
e1dfc56
to
440e72a
Compare
add a new `graph` cached attribute to the `Bot` object 0c9a0f1
Introduce a new cached attribute
graph
to theBot
object.This PR also moves the
walls_to_graph
function fromutils.py
toteam.py
, where it arguably now belongs. An aliaswalls_to_graph
is left inutils.py
for backward compatibility.Fixes: #789