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

Basic cleanups #3

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open

Conversation

trinity-q
Copy link

Most of this is just dead-code removal: unused variables, unused imports, redundant imports, and commented code.

This includes a commit which normalizes all file-writing to use with blocks. Using with ensures that the file will always be closed when the block ends, so there is no need to explicitly call close() on the file handle - it will always be done for us.

Some other small cleanups, which are detailed in their respective commit log messages.

I don't see a license on this codebase, but I authorize these changes to be incorporated with the parent repository, under whatever license is in use.

A quick flake8 run showed a good number of imports and variables that
were unused.  We also found some object attributes that were unused.

Also took the opportunity to eliminate commented code.

Importing `os` also pulls in `os.path`, so there's no need to import
both.  Removed that from several files.
We found some explicit `close()` calls when writing files in a `with`
block, which is not necessary.  Files are closed when exiting the block,
either by normal execution or by exception.

We also convert a few instances of file writes *not* using `with`
blocks, to use the appropriate `with` syntax.
The `filepath` parameter was no longer used; it seems like the
`xorrspath` has superseded it, but the first was never removed.  It also
allows us to eliminate an unused variable in the calling method.
Jinja's official method for including template-like strings within
templates is to use variable blocks with quoted strings inside.  We will
eliminate the need for callers to provide something which the mock
template can provide on its own.
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.

1 participant