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

refactor utils, add tests, move exceptions into separate module #264

Merged
merged 18 commits into from
Aug 1, 2024

Conversation

demitryfly
Copy link
Contributor

  • Rewrite find_first_unpair_closed_par and remove_par implementations
  • Add new unit tests
  • Remove redundant (?) SimpleDDLParserException (it's better to discuss, backward compatibility may be broken)
  • Create a separate exception module

@xnuinside
Copy link
Owner

@demitryfly tests failed

"""
Remove the parentheses from the given list

Warn: p_list may contain unhashable types for some unexplored reasons
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's better to find the reason why p_list may contain dict. Is it expected?

Copy link
Owner

Choose a reason for hiding this comment

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

yes, it is expected, p_list contains results of parsing statements, usually it something like {'column': name, 'unique': True}, so p_list - always list, but elements of this list can be dicts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I rewrote this docstring then.

@demitryfly demitryfly changed the title perform some minor refactorings, add tests refactor utils, add tests Jun 14, 2024
@demitryfly demitryfly changed the title refactor utils, add tests refactor utils, add tests, move exceptions into separate module Jun 14, 2024
@@ -348,7 +346,7 @@ def run(
Dict == one entity from ddl - one table or sequence or type.
"""
if output_mode not in dialect_by_name:
raise SimpleDDLParserException(
Copy link
Contributor Author

@demitryfly demitryfly Jun 14, 2024

Choose a reason for hiding this comment

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

I am not sure, if someone uses this exception in their code (to catch it in try-except, for instance). If, it is possible, then it is more correct to make an alias and deprecate it officially.

Copy link
Owner

@xnuinside xnuinside Jul 28, 2024

Choose a reason for hiding this comment

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

Do not rename exceptions, I didn’t merge it because of those changes. Sorry for long delay with review. Didn’t have any time

Copy link
Contributor Author

@demitryfly demitryfly Jul 29, 2024

Choose a reason for hiding this comment

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

Fixed.
Let me know, it there are something else to be fixed :)

Copy link
Contributor Author

@demitryfly demitryfly Jul 29, 2024

Choose a reason for hiding this comment

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

I think, there is no reason to exist both SimpleDDLParserException and DDLParserError exception type. Only backward compatibility. (If I understood correctly)

@xnuinside xnuinside merged commit 5533ede into xnuinside:main Aug 1, 2024
2 of 3 checks passed
@demitryfly demitryfly deleted the some-refactorings-1 branch August 1, 2024 21:42
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