Quellcode durchsuchen

HUE-8758 [connectors] Small code styling refactoring in lib fs

Romain vor 6 Jahren
Ursprung
Commit
f9d930b41b

+ 12 - 4
desktop/core/src/desktop/lib/fsmanager.py

@@ -33,7 +33,6 @@ from hadoop.cluster import get_hdfs
 from hadoop.conf import has_hdfs_enabled
 
 
-
 SUPPORTED_FS = ['hdfs', 's3a', 'adl', 'abfs', 'gs']
 
 
@@ -62,9 +61,11 @@ def is_enabled(fs=None):
   elif fs == 'gs':
     return is_gs_enabled()
 
+
 def is_enabled_and_has_access(fs=None, user=None):
   return is_enabled(fs) and has_access(fs, user)
 
+
 def _get_client(fs=None):
   if fs == 'hdfs':
     return get_hdfs
@@ -110,6 +111,13 @@ def get_filesystem(name='default'):
 def get_filesystems(user):
   return [fs for fs in SUPPORTED_FS if is_enabled(fs) and has_access(fs, user)]
 
-
-
-
+def _get_client(fs=None):
+  if fs == 'hdfs':
+    return get_hdfs
+  elif fs == 's3a':
+    return aws.client.get_client
+  elif fs == 'adl':
+    return azure.client.get_client
+  elif fs == 'abfs':
+    return azure.client.get_client_abfs
+  return None

+ 0 - 1
desktop/libs/aws/src/aws/s3/s3test_utils.py

@@ -27,7 +27,6 @@ from nose.plugins.skip import SkipTest
 import aws
 
 from contextlib import contextmanager
-
 from aws.s3 import parse_uri, join
 
 

+ 2 - 0
desktop/libs/aws/src/aws/tests.py

@@ -24,8 +24,10 @@ from nose.tools import assert_equal, assert_true, assert_not_equal
 from aws import conf
 from aws.client import clear_cache, Client, get_client, get_credential_provider, current_ms_from_utc
 
+
 LOG = logging.getLogger(__name__)
 
+
 class TestAWS(unittest.TestCase):
   def test_with_credentials(self):
     try:

+ 2 - 3
desktop/libs/hadoop/src/hadoop/conf.py

@@ -21,8 +21,8 @@ import os
 
 from django.utils.translation import ugettext_lazy as _t
 
-from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection, coerce_bool
 from desktop.conf import default_ssl_validate
+from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection, coerce_bool
 
 
 LOG = logging.getLogger(__name__)
@@ -46,7 +46,6 @@ def find_file_recursive(desired_glob, root):
   return f
 
 
-
 UPLOAD_CHUNK_SIZE = Config(
   key="upload_chunk_size",
   help="Size, in bytes, of the 'chunks' Django should store into memory and feed into the handler. Default is 64MB.",
@@ -149,7 +148,7 @@ def get_spark_history_server_security_enabled():
   from metadata.conf import MANAGER
   from metadata.manager_client import ManagerApi
   if MANAGER.API_URL.get():
-      return ManagerApi().get_spark_history_server_security_enabled()
+    return ManagerApi().get_spark_history_server_security_enabled()
   return False