Skip to content

slacked pipenv parser #42

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

Merged
merged 1 commit into from
Nov 9, 2021
Merged

slacked pipenv parser #42

merged 1 commit into from
Nov 9, 2021

Conversation

jkowalleck
Copy link
Member

@jkowalleck jkowalleck commented Oct 28, 2021

see the comments in the changed file for reasons for this PR

@@ -56,4 +56,3 @@ class PipEnvFileParser(PipEnvParser):
def __init__(self, pipenv_lock_filename: str):
with open(pipenv_lock_filename) as r:
super(PipEnvFileParser, self).__init__(pipenv_contents=r.read())
r.close()
Copy link
Member Author

@jkowalleck jkowalleck Oct 28, 2021

Choose a reason for hiding this comment

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

was not needed.
the stream was closed already automatically, as soon as the streams context was exited (__exit__()).
context exit happened as soon as the with block was finished.


for package_name in pipfile_lock_contents['default'].keys():
Copy link
Member Author

Choose a reason for hiding this comment

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

simplified by iterating over the dict's items as (key, value) tuple.

# Add download location with hashes stored in Pipfile.lock
if 'hashes' in package_data.keys():
Copy link
Member Author

Choose a reason for hiding this comment

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

this is a very slow way to test for existance of keys.
used dict.get() - which returns None if the key does not exist ...

this way the whole process was slacked and more forgiving to possible malformed pipenv files ...

@jkowalleck jkowalleck requested a review from madpah October 30, 2021 10:19
@jkowalleck jkowalleck marked this pull request as draft October 30, 2021 10:26
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck jkowalleck marked this pull request as ready for review October 30, 2021 10:45
@jkowalleck jkowalleck added the enhancement New feature or request label Nov 6, 2021
@jkowalleck jkowalleck requested a review from a team November 7, 2021 09:16
@jkowalleck jkowalleck merged commit 08bc4ab into CycloneDX:main Nov 9, 2021
@jkowalleck jkowalleck deleted the improv-pipenv branch November 9, 2021 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants