Replace `from <module> import ...` with `import <module>`

Description

`from <module> import xyz` brought `xyz` into the namespace of the package. One then use this external function/ object without the context of its package. This is considered bad practices in Python.

`import <module>` requires user to write `<module>.xyz` when using function/object. This explicitly states that `xyz` is a function/ object within `<module>`, and not a function/ object in the current Python module.

Environment

None

Activity

Show:
Kimyen Truong
February 7, 2019, 11:05 PM

Per discussion with in https://github.com/Sage-Bionetworks/synapsePythonClient/pull/654, we will follow pipenv convention where:

  • for external imports, use import

    • if the external import contains sub-module, we will use alias in which . will be replaced with _

  • for synapseclient imports, we will use relative path with from . imports …

Thomas Yu
March 19, 2020, 2:33 AM

, you are probably most aware about this issue as well. How can i see this is done as the PR above was aborted.

Ziming Dong
March 19, 2020, 2:37 AM
Thomas Yu
March 19, 2020, 3:18 AM

, Seeing as you reviewed that PR, you can probably close. Looks fine to me

Ziming Dong
March 20, 2020, 5:37 AM

Was completed by but JIRA wont let me keep her as assignee to close the issue so I'm assigning to myself

Assignee

Ziming Dong

Reporter

Kimyen Truong

Labels

Validator

Ziming Dong

Development Area

None

Release Version History

None

Fix versions

Priority

Major
Configure