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 TOML support to the config parser #580

Merged
merged 4 commits into from
Mar 18, 2024
Merged

Add TOML support to the config parser #580

merged 4 commits into from
Mar 18, 2024

Conversation

Miauwkeru
Copy link
Contributor

(DIS-2598)

@Miauwkeru Miauwkeru requested a review from Poeloe March 15, 2024 14:03
@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 74.74%. Comparing base (7a0617b) to head (2e87b94).

Files Patch % Lines
dissect/target/helpers/configutil.py 71.42% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #580   +/-   ##
=======================================
  Coverage   74.73%   74.74%           
=======================================
  Files         288      288           
  Lines       23915    23928   +13     
=======================================
+ Hits        17874    17884   +10     
- Misses       6041     6044    +3     
Flag Coverage Δ
unittests 74.74% <71.42%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pyproject.toml Outdated
@@ -73,6 +73,7 @@ full = [
#
# Until such time that this dependency can be installed through
# flow.record, we define it as a dependency of dissect.target.
"tomli; python_version<'3.11'",
Copy link
Member

Choose a reason for hiding this comment

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

Can you put this above the comment? The comment applies to the zstandard dependency.

Comment on lines 45 to 47
TOML = True
except ImportError:
TOML = False
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TOML = True
except ImportError:
TOML = False
HAS_TOML = True
except ImportError:
HAS_TOML = False

To be consistent with other places where we have this pattern.

Copy link
Member

Choose a reason for hiding this comment

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

"""Parses a Toml file."""

def parse_file(self, fh: TextIO) -> None:
if TOML:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if TOML:
if HAS_TOML:

pyproject.toml Outdated
"zstandard",
"tomli; python_version<'3.11'",
Copy link
Member

Choose a reason for hiding this comment

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

Now it's no longer in alphabetical order 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed :)

@Miauwkeru Miauwkeru merged commit f52b0ab into main Mar 18, 2024
15 of 16 checks passed
@Miauwkeru Miauwkeru deleted the unix-config-toml branch March 18, 2024 15:36
Zawadidone pushed a commit to Zawadidone/dissect.target that referenced this pull request Apr 5, 2024
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.

3 participants