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

Regexp functions support #13

Merged
merged 5 commits into from
Aug 17, 2023
Merged

Regexp functions support #13

merged 5 commits into from
Aug 17, 2023

Conversation

Olegt0rr
Copy link
Contributor

@Olegt0rr Olegt0rr commented Aug 14, 2023

Closes #12

@Olegt0rr Olegt0rr added the enhancement New feature or request label Aug 14, 2023
@codecov
Copy link

codecov bot commented Aug 14, 2023

Codecov Report

Merging #13 (4c3c625) into master (3944b2b) will increase coverage by 0.17%.
Report is 2 commits behind head on master.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   96.13%   96.30%   +0.17%     
==========================================
  Files          17       17              
  Lines         362      379      +17     
==========================================
+ Hits          348      365      +17     
  Misses         14       14              
Flag Coverage Δ
unittests 96.30% <100.00%> (+0.17%) ⬆️

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

Files Changed Coverage Δ
magic_filter/__init__.py 100.00% <100.00%> (ø)
magic_filter/exceptions.py 100.00% <100.00%> (ø)
magic_filter/magic.py 99.44% <100.00%> (+0.04%) ⬆️

@Olegt0rr
Copy link
Contributor Author

As other solution, string mode may be replaced directly with callable

F.text.regexp(r"(\w+-\d+)", mode=re.findall).as_("issues"),

@JrooTJunior
Copy link
Member

JrooTJunior commented Aug 14, 2023

It can be completed without making it breaking.

For example you can set mode by default to None, when you set search as True just set mode to SEARCH and show deprecation warning, when search is False set mode to MATCH but when both parameters are set just raise an error that indicates you can't set both parameters.

.regexp(...) -> .regexp(..., mode=RegexpMode.MATCH)
.regexp(..., search=True) -> .regexp(..., mode=RegexpMode.SEARCH) + DeprecationWarning
.regexp(..., search=True, mode=RegexpMode.FETCHALL) -> Error

@Olegt0rr
Copy link
Contributor Author

@JrooTJunior, okay, I'll take it.

What do you prefer enum params or callable?
If enum, in which file should I place it?

@JrooTJunior
Copy link
Member

I'd like to use enum or literals instead of passing methods in due to instead of re methods can be passed any function

Olegt0rr and others added 3 commits August 17, 2023 00:51
Modified the 'in_' and 'not_in' methods in 'magic_filter/magic.py' to accept both 'Container' and 'MagicT' types as iterable. This change provides more flexibility in specifying iterables in these methods and broadens their potential usage.
@Olegt0rr Olegt0rr self-assigned this Aug 16, 2023
@JrooTJunior JrooTJunior merged commit 9592bbc into master Aug 17, 2023
34 checks passed
@JrooTJunior JrooTJunior deleted the findall-support branch August 17, 2023 23:13
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.

Regexp findall support
2 participants