comparison hgext/convert/transport.py @ 49849:de9ffb82ef4d

typing: suppress a bunch of potential import-error cases in extensions As flagged by pytype locally. Either the ImportError is locally handled, or the imported module was previously determined to be present by `hgave` (for the phabricator extension), or is handled by the `hgext.convert.subversion` module when imported (for the `hgext.convert.transport` module).
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 06 Jan 2023 13:04:50 -0500
parents 642e31cb55f0
children e054898624db
comparison
equal deleted inserted replaced
49848:139f713010ea 49849:de9ffb82ef4d
15 # GNU General Public License for more details. 15 # GNU General Public License for more details.
16 16
17 # You should have received a copy of the GNU General Public License 17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, see <http://www.gnu.org/licenses/>. 18 # along with this program; if not, see <http://www.gnu.org/licenses/>.
19 19
20 # pytype: disable=import-error
20 import svn.client 21 import svn.client
21 import svn.core 22 import svn.core
22 import svn.ra 23 import svn.ra
24
25 # pytype: enable=import-error
23 26
24 Pool = svn.core.Pool 27 Pool = svn.core.Pool
25 SubversionException = svn.core.SubversionException 28 SubversionException = svn.core.SubversionException
26 29
27 from mercurial.pycompat import getattr 30 from mercurial.pycompat import getattr
35 svn_config = None 38 svn_config = None
36 39
37 40
38 def _create_auth_baton(pool): 41 def _create_auth_baton(pool):
39 """Create a Subversion authentication baton.""" 42 """Create a Subversion authentication baton."""
40 import svn.client 43 import svn.client # pytype: disable=import-error
41 44
42 # Give the client context baton a suite of authentication 45 # Give the client context baton a suite of authentication
43 # providers.h 46 # providers.h
44 providers = [ 47 providers = [
45 svn.client.get_simple_provider(pool), 48 svn.client.get_simple_provider(pool),