Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial extension for storage preview #138

Merged
merged 6 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolved more pylint failures
pylint errors

relative import pylint
  • Loading branch information
williexu committed Apr 16, 2018
commit bb986ecc74aaeb92c5e4a2eb21f84eb3e6d80a58
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-argument

[TYPECHECK]
# For Azure CLI extensions, we ignore some import errors as they'll be available in the environment of the CLI
ignored-modules=azure,azure.cli,azure.cli.core,azure.cli.core.commands,knack
ignored-modules=azure,azure.cli,azure.cli.core,azure.cli.core.commands,knack,msrestazure,argcomplete

[FORMAT]
max-line-length=120
Expand Down
3 changes: 1 addition & 2 deletions src/storage-preview/azext_storage_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.register_source_uri_arguments(validator=validate_source_uri)

with self.argument_context('storage blob copy start-batch', arg_group='Copy Source') as c:
from ._validators import (get_source_file_or_blob_service_client,
process_blob_copy_batch_namespace)
from ._validators import (get_source_file_or_blob_service_client, process_blob_copy_batch_namespace)

c.argument('source_client', ignore_type, validator=get_source_file_or_blob_service_client)

Expand Down
4 changes: 2 additions & 2 deletions src/storage-preview/azext_storage_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.commands import CliCommandType
from azure.cli.core.profiles import ResourceType
from ._client_factory import (cf_sa, blob_data_service_factory,
page_blob_service_factory, file_data_service_factory,
queue_data_service_factory, table_data_service_factory,
cloud_storage_account_service_factory,
multi_service_properties_factory)
from .sdkutil import cosmosdb_table_exists
from azure.cli.core.commands import CliCommandType
from azure.cli.core.profiles import ResourceType


def load_command_table(self, _): # pylint: disable=too-many-locals, too-many-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __init__(self, cloud, moniker):
self.snapshot = None
self.sas_token = None

from six.moves.urllib.parse import urlparse # pylint: disable=import-error
url = urlparse(moniker)
from six.moves import urllib_parse # pylint: disable=import-error
url = urllib_parse.urlparse(moniker)

self._is_url = (url.scheme == 'http' or url.scheme == 'https')
if not self._is_url:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, parameter_name='test_dir'):
super(StorageTestFilesPreparer, self).__init__(name_prefix='test', name_len=24)
self.parameter_name = parameter_name

def create_resource(self, name, **kwargs):
def create_resource(self, _name, **_kwargs):
temp_dir = os.path.join(tempfile.gettempdir(), self.random_name)
if not os.path.exists(temp_dir):
os.mkdir(temp_dir)
Expand All @@ -78,7 +78,7 @@ def create_resource(self, name, **kwargs):
setattr(self, '_temp_dir', temp_dir)
return {self.parameter_name: temp_dir}

def remove_resource(self, name, **kwargs):
def remove_resource(self, _name, **_kwargs):
temp_dir = self.get_temp_dir()
if temp_dir:
shutil.rmtree(temp_dir, ignore_errors=True)
Expand Down
9 changes: 5 additions & 4 deletions src/storage-preview/azext_storage_preview/url_quote_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@


def encode_for_url(url_component, safe=SAFE_CHARS):
from six.moves.urllib.parse import quote as url_quote # pylint: disable=import-error
from six.moves import urllib_parse # pylint: disable=import-error
url_quote = urllib_parse.quote
return url_quote(url_component, safe)


def encode_url_path(url, safe=SAFE_CHARS):
from six.moves.urllib.parse import urlparse, urlunparse # pylint: disable=import-error
url_parts = urlparse(url)
from six.moves import urllib_parse # pylint: disable=import-error
url_parts = urllib_parse.urlparse(url)
quoted_path = encode_for_url(url_parts.path, safe)
return urlunparse(url_parts[:2] + (quoted_path,) + url_parts[3:])
return urllib_parse.urlunparse(url_parts[:2] + (quoted_path,) + url_parts[3:])


def make_encoded_file_url_and_params(file_service, share, file_dir, file_name, sas_token, safe=SAFE_CHARS):
Expand Down