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

Refactor the internals of analyze #194

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

psykzz
Copy link
Contributor

@psykzz psykzz commented Nov 22, 2020

Description of the Change

This removes path generation from string concat, this is instead replaced with os.path.join, which takes care to handle the differences between OS.

Additionally removes os.chdir since this makes it harder to understand what is happening in the script, since the current directory in the loop is important, but difficult to reason.

Additionally splits out the csv, json and markdown file writers into their own files.
(We may want to consider a single interface, but i didn't want to touch that yet).

Lastly avoids multiple reads to the config file by putting it into its own module where the file is cached (via imports).

Tests are still coming, but this is just to highlight the progress so far.

Benefits

This should make things easier to maintain.

Applicable Issues

N/A

This removes path generation from string concat, this is instead replaced with os.path.join, which takes care to handle the differences between OS.

Additionally removes os.chdir since this makes it harder to understand what is happening in the script, since the current directory in the loop is important, but difficult to reason.

Additionally splits out the csv, json and markdown file writers into their own files.
(We may want to consider a single interface, but i didn't want to touch that yet).

Lastly avoids multiple reads to the config file by putting it into its own module where the file is cached (via imports).

Tests are still coming, but this is just to highlight the progress so far.
@psykzz psykzz marked this pull request as draft November 22, 2020 07:35
Comment on lines -13 to +12
elif config["sims"][args.dir[:-1]]["builds"]:
elif config["sims"][args.dir]["builds"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

wont this fail? Since args.dir is talents/ but we need to lookup based on talents

Copy link
Contributor Author

@psykzz psykzz Nov 22, 2020

Choose a reason for hiding this comment

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

No since we now normalise the path, so a user could do ./talents or ./talents/ it would be normalised to talents

See https://github.com/WarcraftPriests/sl-shadow-priest/pull/194/files#diff-ec7f77098f7800c209790b5e76053a876d0bb993248972a80a8941a573ba9323R213

@psykzz psykzz marked this pull request as ready for review December 5, 2020 19:02
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