mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 23:09:32 +01:00
perf: import some things later
Saves on startup time
This commit is contained in:
+2
-1
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
||||
from dvc.scheme import Schemes
|
||||
from dvc.utils.compat import open
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
from dvc.progress import Tqdm
|
||||
@@ -79,6 +78,8 @@ class RemoteHTTP(RemoteBASE):
|
||||
return etag
|
||||
|
||||
def _request(self, method, url, **kwargs):
|
||||
import requests
|
||||
|
||||
kwargs.setdefault("allow_redirects", True)
|
||||
kwargs.setdefault("timeout", self.REQUEST_TIMEOUT)
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ from dvc.scheme import Schemes
|
||||
from dvc.remote.pool import get_connection
|
||||
from dvc.progress import Tqdm
|
||||
|
||||
from .connection import SSHConnection
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -139,6 +136,8 @@ class RemoteSSH(RemoteBASE):
|
||||
)
|
||||
self.password = password
|
||||
|
||||
from .connection import SSHConnection
|
||||
|
||||
return get_connection(
|
||||
SSHConnection,
|
||||
host,
|
||||
|
||||
+1
-1
@@ -4,7 +4,6 @@ import sys
|
||||
import os
|
||||
import time
|
||||
import logging
|
||||
import requests
|
||||
import colorama
|
||||
from pkg_resources import parse_version
|
||||
|
||||
@@ -82,6 +81,7 @@ class Updater(object): # pragma: no cover
|
||||
|
||||
def _get_latest_version(self):
|
||||
import json
|
||||
import requests
|
||||
|
||||
try:
|
||||
r = requests.get(self.URL, timeout=self.TIMEOUT_GET)
|
||||
|
||||
+1
-2
@@ -1,8 +1,6 @@
|
||||
from contextlib import contextmanager
|
||||
import io
|
||||
|
||||
import requests
|
||||
|
||||
from dvc.utils.compat import FileNotFoundError
|
||||
|
||||
|
||||
@@ -28,6 +26,7 @@ def open_url(url, mode="r", encoding=None):
|
||||
@contextmanager
|
||||
def iter_url(url, chunk_size=io.DEFAULT_BUFFER_SIZE):
|
||||
"""Iterate over chunks requested from url."""
|
||||
import requests
|
||||
|
||||
def request(headers=None):
|
||||
the_url = url() if callable(url) else url
|
||||
|
||||
Reference in New Issue
Block a user