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

add support for Stata 17 graphs #394

Merged
merged 3 commits into from
Apr 4, 2022

Conversation

simon-d-s
Copy link
Contributor

@simon-d-s simon-d-s commented May 16, 2021

  • closes graph display bug #391
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@@ -299,7 +299,7 @@ def expect(self, text, child, md5, text_to_exclude=None, display=True):
error_re = r'^r\((\d+)\);'

# The minimum linesize in Stata is 40 characters
g_exp = r'\(file {}'.format(self.cache_dir_str[:34])
g_exp = r'\(?file {}'.format(self.cache_dir_str[:34])
Copy link
Owner

Choose a reason for hiding this comment

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

Probably good to add a comment above this noting that the ( doesn't exist in Stata 17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback @kylebarron , I've added a comment in 97709b6

@kylebarron kylebarron requested a review from mcaceresb May 17, 2021 17:06
@@ -325,6 +329,9 @@ def expect(self, text, child, md5, text_to_exclude=None, display=True):
continue
if match_index == 2:
g_path = [self.expect_graph(child, child.match.group(0))]
if g_path[0] is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@simon-d-s Sorry I've been MIA. Can this be fixed by instead adding ^ at the start of g_exp? Instead of the logic here and the if else logic below, add ^ at the start of g_exp so that the messages for a file not existing and the file being saved are not confused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mcaceresb No problem.
For Stata 17 it would work, but I cannot see how it would work for Stata 16.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@simon-d-s I tested it out on this branch and it was working for me on 15 and 16. I don't have 17 though.

Copy link
Contributor Author

@simon-d-s simon-d-s May 27, 2021

Choose a reason for hiding this comment

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

@mcaceresb Sorry, I did not fully understand what you mean - with the code it's clear now.
Unfortunately, this will not work on Stata 17. As you can see in the following example, the beginnings of the messages for a file not existing and the file being saved differ only by the (:

. sysuse auto
(1978 automobile data)

. hist price
(bin=8, start=3291, width=1576.875)

. graph export foobar.png, replace
(file foobar.png not found)
file foobar.png saved as PNG format

Copy link
Collaborator

Choose a reason for hiding this comment

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

@simon-d-s Ah, I see what you mean. I'll try to review your proposed fix when I get a sec. These weeks are a bit full for me, though.

gaksaray pushed a commit to gaksaray/stata_kernel that referenced this pull request Jul 8, 2021
Implemented changes made in kylebarron#394 for inline graph capabilities in Stata 17.
@gaksaray gaksaray mentioned this pull request Jul 9, 2021
@mcaceresb mcaceresb marked this pull request as ready for review April 4, 2022 01:49
@mcaceresb mcaceresb merged commit a3c7f87 into kylebarron:master Apr 4, 2022
zdlspace0528 added a commit to zdlspace0528/stata_kernel that referenced this pull request Apr 4, 2022
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.

graph display bug
3 participants