Skip to content

Conversation

@skeledrew
Copy link
Contributor

No description provided.

'\n' if i < 2 and cookie_re.match(line)
else line
for i, line in enumerate(f)
line for line in linecache.cache[filename][2]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to use linecache.getlines (not direct access to the cache) and needs to use it instead of opening the file (linecache will open the file if needed) but still checking cookie_re.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I hadn't realized that there was a getlines method as it's missing from the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

return ''.join([
'\n' if i < 2 and cookie_re.match(line)
else line
for line in linecache.getlines(filename)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot enumerate

@alexmojaki
Copy link
Owner

I see the test failure, this actually makes me realise I need to take a different path to resolve this. So you don't need to try and fix this, I'll take care of it.

@alexmojaki
Copy link
Owner

Ended up not going with my original plan, but hey, this works. Thanks for your help!

@alexmojaki alexmojaki merged commit 0f0e0b4 into alexmojaki:master Aug 1, 2021
@alexmojaki
Copy link
Owner

Released in 0.9.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants