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] Clean up helper functions in tools.util #4174

Merged
merged 7 commits into from
Jan 28, 2022

Conversation

strongoier
Copy link
Contributor

Related issue = #3782

This PR serves as the second step towards putting functions under tools.util (see #4172) in correct places.

@netlify
Copy link

netlify bot commented Jan 28, 2022

✔️ Deploy Preview for docsite-preview canceled.

🔨 Explore the source changes: 237ccb0

🔍 Inspect the deploy log: https://app.netlify.com/sites/docsite-preview/deploys/61f3685d4751940007d3dc99

@strongoier
Copy link
Contributor Author

/format

"""
def wrapped(*args, **kwargs):
msg = f'{old} is obsolete. Please use {new} instead.'
raise SyntaxError(msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

TaichiSyntaxError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

print(Style.RESET_ALL, end='')


def deprecated(old, new, warning_type=DeprecationWarning):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still use this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No... We can remove this.

return decorator


def obsolete(old, new):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do this in __getattr__ as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but actually I think this can be removed. We don't need so many levels for deprecating things for now and this is only used in one place one year ago.

@strongoier strongoier changed the title [Refactor] Move warning/deprecated/obsolete/get_traceback to lang.util and hide [Refactor] Clean up helper functions in tools.util Jan 28, 2022
Copy link
Contributor

@lin-hitonami lin-hitonami left a comment

Choose a reason for hiding this comment

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

LGTM!

@strongoier strongoier merged commit 11f8777 into taichi-dev:master Jan 28, 2022
@strongoier strongoier deleted the tracebacks branch January 28, 2022 10:33
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