Fixed SonarQube analysis issues
This commit is contained in:
parent
1859e43daf
commit
0b9c61e7e7
3 changed files with 12 additions and 14 deletions
|
@ -2,14 +2,15 @@
|
|||
|
||||
import functools
|
||||
import logging
|
||||
import lxml.etree as etree
|
||||
import os
|
||||
import requests
|
||||
import shutil
|
||||
import threading
|
||||
from io import BytesIO
|
||||
from re import sub
|
||||
|
||||
import lxml.etree as etree
|
||||
import requests
|
||||
|
||||
from webdav3.connection import *
|
||||
from webdav3.exceptions import *
|
||||
from webdav3.urn import Urn
|
||||
|
@ -174,7 +175,7 @@ class Client(object):
|
|||
if response.status_code == 404:
|
||||
raise RemoteResourceNotFound(path=path)
|
||||
if response.status_code == 405:
|
||||
raise MethodNotSupported(name=action, server=hostname)
|
||||
raise MethodNotSupported(name=action, server=self.webdav.hostname)
|
||||
if response.status_code >= 400:
|
||||
raise ResponseErrorCode(url=self.get_url(path), code=response.status_code, message=response.content)
|
||||
return response
|
||||
|
@ -243,9 +244,8 @@ class Client(object):
|
|||
:return: list of nested file or directory names.
|
||||
"""
|
||||
directory_urn = Urn(remote_path, directory=True)
|
||||
if directory_urn.path() != Client.root:
|
||||
if not self.check(directory_urn.path()):
|
||||
raise RemoteResourceNotFound(directory_urn.path())
|
||||
if directory_urn.path() != Client.root and not self.check(directory_urn.path()):
|
||||
raise RemoteResourceNotFound(directory_urn.path())
|
||||
|
||||
response = self.execute_request(action='list', path=directory_urn.quote())
|
||||
urns = WebDavXmlUtils.parse_get_list_response(response.content)
|
||||
|
@ -817,9 +817,6 @@ class Resource(object):
|
|||
|
||||
|
||||
class WebDavXmlUtils:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def parse_get_list_response(content):
|
||||
"""Parses of response content XML from WebDAV server and extract file and directory names.
|
||||
|
|
|
@ -6,10 +6,13 @@ from webdav3.urn import Urn
|
|||
|
||||
class ConnectionSettings:
|
||||
def is_valid(self):
|
||||
"""
|
||||
Method checks is settings are valid
|
||||
:return: True if settings are valid otherwise False
|
||||
"""
|
||||
pass
|
||||
|
||||
def valid(self):
|
||||
|
||||
try:
|
||||
self.is_valid()
|
||||
except OptionNotValid:
|
||||
|
@ -37,7 +40,6 @@ class WebDAVSettings(ConnectionSettings):
|
|||
disable_check = False
|
||||
|
||||
def __init__(self, options):
|
||||
|
||||
self.options = dict()
|
||||
|
||||
for key in self.keys:
|
||||
|
@ -49,7 +51,6 @@ class WebDAVSettings(ConnectionSettings):
|
|||
self.root = self.root.rstrip(Urn.separate)
|
||||
|
||||
def is_valid(self):
|
||||
|
||||
if not self.hostname:
|
||||
raise OptionNotValid(name="hostname", value=self.hostname, ns=self.ns)
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class ResponseErrorCode(WebDavException):
|
|||
|
||||
class NotEnoughSpace(WebDavException):
|
||||
def __init__(self):
|
||||
pass
|
||||
self.message = "Not enough space on the server"
|
||||
|
||||
def __str__(self):
|
||||
return "Not enough space on the server"
|
||||
return self.message
|
||||
|
|
Loading…
Add table
Reference in a new issue