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

CH-141 merge json files #758

Merged
merged 1 commit into from
Jul 30, 2024
Merged

CH-141 merge json files #758

merged 1 commit into from
Jul 30, 2024

Conversation

filippomc
Copy link
Collaborator

@filippomc filippomc commented Jul 30, 2024

Closes CH-141

Implemented solution

Implemented the same logic we have for yaml files

How to test this PR

Add an overridden json file in the resources or any other place within the project.
Unit tests are covering what we need anyway.

Sanity checks:

  • The pull request is explicitly linked to the relevant issue(s)
  • The issue is well described: clearly states the problem and the general proposed solution(s)
  • In this PR it is explicitly stated how to test the current change
  • The labels in the issue set the scope and the type of issue (bug, feature, etc.)
  • The relevant components are indicated in the issue (if any)
  • All the automated test checks are passing
  • All the linked issues are included in one Sprint
  • All the linked issues are in the Review state
  • All the linked issues are assigned

Breaking changes (select one):

  • The present changes do not change the preexisting api in any way
  • This PR and the issue are tagged as a breaking-change and the migration procedure is well described above

Possible deployment updates issues (select one):

  • There is no reason why deployments based on CloudHarness may break after the current update
  • This PR and the issue are tagged as alert:deployment

Test coverage (select one):

  • Tests for the relevant cases are included in this pr
  • The changes included in this pr are out of the current test coverage scope

Documentation (select one):

  • The documentation has been updated to match the current changes
  • The changes included in this PR are out of the current documentation scope

Nice to have (if relevant):

  • Screenshots of the changes
  • Explanatory video/animated gif

@@ -410,7 +410,7 @@ def image_tag(self, image_name, build_context_path=None, dependencies=()):
ignore = set(DEFAULT_IGNORE)
if os.path.exists(ignore_path):
with open(ignore_path) as f:
ignore = ignore.union({line.strip() for line in f})
ignore = ignore.union({line.strip() for line in f if line.strip() and not line.startswith('#')})
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion

union will work with any iterable, so you can remove the braces to not assign to a set first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see that might be less efficient but as this is not changing the overall complexity I have a slight preference towards type safety with these numbers -- ~10-100. Also who knows what the underlying optimizations are

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was curious so tried and it's actually more efficient to do as you suggest:

>>> timeit.timeit(lambda: {i for i in range(100000)}.update({i for i in range(100000)}), number=100)
1.661276631999499
>>> timeit.timeit(lambda: {i for i in range(100000)}.update(i for i in range(100000)), number=100)
1.2412546089981333

@filippomc filippomc merged commit f81447b into develop Jul 30, 2024
6 of 7 checks passed
@filippomc filippomc deleted the feature/CH-141 branch July 30, 2024 14:32
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