Skip to content

feat(strtools): ✨ add method for extracting text between brackets - #155

Open
lguerard wants to merge 6 commits into
imcf:develfrom
lguerard:extract_name
Open

lguerard wants to merge 6 commits into
imcf:develfrom
lguerard:extract_name

Conversation

@lguerard

Copy link
Copy Markdown
Contributor

This is particularly important for multi series file in OMERO as they are named: file_name.ext [file_name.ext (seriesx)]

This is particularly important for multi series file in OMERO as they are named:
file_name.ext [file_name.ext (seriesx)]
@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33%. Comparing base (1f6b508) to head (4028488).

Additional details and impacted files
@@         Coverage Diff          @@
##           devel   #155   +/-   ##
====================================
  Coverage     33%    33%           
====================================
  Files         25     25           
  Lines       1806   1819   +13     
====================================
+ Hits         591    604   +13     
  Misses      1215   1215           

☔ View full report in Codecov by Harness.
📢 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.

@ehrenfeu

Copy link
Copy Markdown
Member

➡️ Please add tests 🧪 for this.

@ehrenfeu
ehrenfeu self-requested a review September 16, 2026 13:44
@ehrenfeu ehrenfeu added unit testing A unit test should be created enhancement New feature or request new-minor Change introduced in PR will require a new minor release. labels Sep 16, 2026
@ehrenfeu ehrenfeu added this to the 2.0.0 milestone Sep 16, 2026
@lguerard

lguerard commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

I added tests but I think I broke codecov since it's been running for 17hours and still ongoing...

Comment thread src/imcflibs/strtools.py
Comment on lines +208 to +216
for index in range(len(text) - 1, -1, -1):
if text[index] == "]":
if end is None:
end = index
depth += 1
elif text[index] == "[":
depth -= 1
if depth == 0:
return text[index + 1 : end]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, but I'm really struggling to understand what the nested range(), depth and index are doing and how they're playing together, please add comments that explain the code.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new-minor Change introduced in PR will require a new minor release. unit testing A unit test should be created

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants