Skip to content

feat(detector_details): Add mathod to retrieve detector details #140

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

Closed
wants to merge 1 commit into from

Conversation

salome-voltz
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 79.26829% with 17 lines in your changes missing coverage. Please review.

Project coverage is 94.67%. Comparing base (d246b6a) to head (225c7fb).

Files with missing lines Patch % Lines
pygitguardian/models.py 78.37% 16 Missing ⚠️
pygitguardian/client.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #140      +/-   ##
==========================================
- Coverage   95.73%   94.67%   -1.06%     
==========================================
  Files           5        5              
  Lines        1196     1278      +82     
==========================================
+ Hits         1145     1210      +65     
- Misses         51       68      +17     
Flag Coverage Δ
unittests 94.67% <79.26%> (-1.06%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +739 to +740
""" "
Response from /v1/detectors, to retrieve a detetor details
Copy link
Collaborator

Choose a reason for hiding this comment

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

typos (but +1 for adding a docstring 🤩)

Suggested change
""" "
Response from /v1/detectors, to retrieve a detetor details
"""
Response from /v1/detectors, to retrieve a detector details


obj: Union[Detail, DetectorDetailsResponse]
if is_ok(resp):
print(resp.json())
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔥

return DetectorDetails(**data)


class DetectorDetails(Base, FromDictMixin):
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you make this a dataclass then you don't need to write that long __init__() function.

And using marshmallow_dataclass you don't need to write the schema class manually.

You can have a look at SecretIncident for inspiration.

return DetectorDetails(**data)


class DetectorDetailsResponse(Base, FromDictMixin):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need both a DetectorDetails and a DetectorDetailsReponse? I think we could make detector_details() return a DetectorDetails instance, but maybe I am missing something.

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