Skip to content
Myr

Merge pull request #1040 from minho42/Simplify-import-split

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Simplify splitting import_name in import_string()

authored by David Lord · committed by GitHub · parents cc89256, 486a2f4 · Browse files · 1 file+1 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−3 removed

  • other:+1 added−3 removed

1 file+1 added−3 removed

modified:jinja2/utils.py+1 added-3 removed
134 unmodified lines
135 try:136 if ':' in import_name:137 module, obj = import_name.split(':', 1)138 elif '.' in import_name:139 items = import_name.split('.')140 module = '.'.join(items[:-1])141 obj = items[-1]139 module, _, obj = import_name.rpartition('.')140 else:141 return __import__(import_name)142 return getattr(__import__(module, None, None, [obj]), obj)143 except (ImportError, AttributeError):
506 unmodified lines