Skip to content

Refactor the internals of analyze - #194

Open
psykzz wants to merge 9 commits into
WarcraftPriests:masterfrom
psykzz:feat/analyze-refactor
Open

Refactor the internals of analyze#194
psykzz wants to merge 9 commits into
WarcraftPriests:masterfrom
psykzz:feat/analyze-refactor

Conversation

@psykzz

@psykzz psykzz commented Nov 22, 2020

Copy link
Copy Markdown
Contributor

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 thread internal/utils.py
Comment on lines -13 to +12
elif config["sims"][args.dir[:-1]]["builds"]:
elif config["sims"][args.dir]["builds"]:

Copy link
Copy Markdown
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

@psykzz psykzz Nov 22, 2020

Copy link
Copy Markdown
Contributor Author

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