Skip to content

Fixes #8 Added common regular expressions for builtin.yaml.#43

Open
Aditi840 wants to merge 5 commits intoLangTrans:mainfrom
Aditi840:git-checkout--b-fix-issue-8
Open

Fixes #8 Added common regular expressions for builtin.yaml.#43
Aditi840 wants to merge 5 commits intoLangTrans:mainfrom
Aditi840:git-checkout--b-fix-issue-8

Conversation

@Aditi840
Copy link
Copy Markdown

No description provided.

@B-R-P
Copy link
Copy Markdown
Collaborator

B-R-P commented Aug 22, 2023

There is a syntax error and only add regex to match language constructs. No generic regex like credit card number.

@Aditi840
Copy link
Copy Markdown
Author

@B-R-P I have made some changes to the file, will you please have a look at it

builtin.yaml Outdated
Pattern: (?:\/[\w-]+)+\/?

credit-card numbers: '\b\d{4}-\d{4}-\d{4}-\d{4}\b' #credit-card numbers
Hashes (MD5, SHA-1, SHA-256):
Copy link
Copy Markdown
Collaborator

@B-R-P B-R-P Aug 23, 2023

Choose a reason for hiding this comment

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

Wrong format

@B-R-P
Copy link
Copy Markdown
Collaborator

B-R-P commented Aug 23, 2023

Format is not correct.
Most of regex are unnecessary for this program.
Only add regexs to match language constucts

@Aditi840
Copy link
Copy Markdown
Author

@B-R-P This time, I added regexs to match language constructs only, using the above examples of the file, have a look at it.

@miikkuu
Copy link
Copy Markdown

miikkuu commented Sep 2, 2023

Hello @Aditi840 make sure your function is error free, for the tests to pass smoothly.
This is the problem:

It looks like you're encountering a TypeError and a SystemExit exception in your Python code.

1.This error is happening in the replace_variables function, specifically in this line :

source_string = source_string.replace(f"<{variable_name}>", variable_value)

It seems like variable_value is expected to be a string, but it's a dictionary. You should check where variable_value is being assigned and make sure it contains a string.

  1. The SystemExit exception is raised in your sys_exit() function, which is called from the extract function:

File "/home/runner/work/LangTrans/LangTrans/LangTrans.py", line 410, in extract
sys_exit()
This suggests that something in your code is calling sys_exit(), which is causing the program to exit unexpectedly. You should investigate why this function is being called and under what conditions.

@B-R-P
Copy link
Copy Markdown
Collaborator

B-R-P commented Sep 3, 2023

Thank you. I will check it out

list: \\[(?:[^\\[\\]]*|(?R))*\\] # Match lists (assuming they're defined on a single line)

dict: {(?:[^{}]*|(?R))*} # Match dictionaries/objects (assuming they're defined on a single line)
expressions:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This causes the error in test.
can't use categories

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@B-R-P, If I remove the list and dict then will it be ok.

@Aditi840
Copy link
Copy Markdown
Author

Aditi840 commented Sep 7, 2023

@B-R-P, I removed them, will you now run the test again.

@B-R-P
Copy link
Copy Markdown
Collaborator

B-R-P commented Sep 7, 2023

This line is incorrect. Why expression as main node of other regexs?


boolean: "true|false" # Match boolean values

null: "null" # Match null value
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not needed

@B-R-P
Copy link
Copy Markdown
Collaborator

B-R-P commented Sep 7, 2023

Please try LangTrans first, then add relevant regular expressions

@Aditi840
Copy link
Copy Markdown
Author

Aditi840 commented Sep 7, 2023

@B-R-P, will do

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