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

fixed f-string unmatched error in src/sylva/helpers/generic.py #4

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

SpiritGun91
Copy link
Contributor

This error prevented me from running sylva but once fixed it runs fine on my machine. Hope this helps.

@ppfeister ppfeister added the bug Something isn't working label Aug 4, 2024
@ppfeister
Copy link
Owner

The single quotes shouldn't be an issue by themselves, at least not theoretically, and it took me a second to spot what you were fixing....... maybe it's a conflict with the inner f-string's single quotes? You would think that those would be fine as they're contained within another f-string

Odd that it was causing you problems but not me.

If you run the original again, would you mind sharing the exact error message here? I'd like to see what the difference may be system to system

(feel free to redact any identifying information)

@SpiritGun91
Copy link
Contributor Author

Traceback (most recent call last):
File "/home/anthonygil/pentest/sylva/bin/sylva", line 5, in
from sylva.console import interactive
File "/home/anthonygil/pentest/sylva/lib/python3.10/site-packages/sylva/console.py", line 6, in
from .handler import Handler
File "/home/anthonygil/pentest/sylva/lib/python3.10/site-packages/sylva/handler.py", line 7, in
from .collector import Collector
File "/home/anthonygil/pentest/sylva/lib/python3.10/site-packages/sylva/collector.py", line 4, in
from .helpers.generic import ResultDataFrame
File "/home/anthonygil/pentest/sylva/lib/python3.10/site-packages/sylva/helpers/generic.py", line 86
if hashlib.sha256(query.replace(' ', '').lower().encode('utf-8')).hexdigest() in requests.get(url=f'{urlunparse(urlparse(github_maintainer_url)._replace(netloc=f'gist.{tldx(github_maintainer_url).domain}.{tldx(github_maintainer_url).suffix}'))}/{id}/raw').text:
^^^^
SyntaxError: f-string: unmatched '('

@SpiritGun91
Copy link
Contributor Author

Also my bad idk anything about Conventional Commits format lol.

@ppfeister
Copy link
Owner

Yup, that's right after the inner single quote. Interesting.

It's beyond me as to why it affects some systems and not others. Let me just validate it real quick and I'll merge it in

@ppfeister
Copy link
Owner

Also my bad idk anything about Conventional Commits format lol.

No worries!

Something like fix: f-string misquote would be the correct way for CC -- the prefix just makes it easy to to find things in a long list of commits. Not going to cherry pick things though it's fine in my book

Copy link
Owner

@ppfeister ppfeister left a comment

Choose a reason for hiding this comment

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

LGTM! Everything checks out when testing

Appreciate that you not only raised the bug but proposed a fix as well!

@ppfeister ppfeister merged commit 90226e5 into ppfeister:master Aug 4, 2024
1 check failed
@SpiritGun91
Copy link
Contributor Author

Thnx for the quick reply and the merge!

@ppfeister
Copy link
Owner

ppfeister commented Aug 4, 2024

Just if you were curious, I've figured out what the discrepancy was --

You're running Python 3.10 (based on the file path in your paste). Something changed in regards to string interpolation between 3.10 and 3.12, which is what my development environment was built using. After doing a quick pdm use 3.10, the error suddenly appears.

Good catch.

@SpiritGun91
Copy link
Contributor Author

Makes sense. Apt-get is usually behind with python versions, at least with Ubuntu and Kali in my experience so good fix I guess lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants