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

Fixed Code Quality Issues #6

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .deepsource.toml
@@ -0,0 +1,8 @@
version = 1

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
7 changes: 4 additions & 3 deletions src/nodefs.py
Expand Up @@ -40,7 +40,7 @@ def print_all_nodes(node, level=0):
print_all_nodes(child_node, level+1)


class FSNodeStats(object):
class FSNodeStats:
def __init__(self):
self.count_total = 0
self.count_files = 0
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_human_readable_size(self, suffix='B'):
return "%.1f%s%s" % (num, 'Yi', suffix)


class FSNode(object):
class FSNode:
def __init__(self, full_path, date_modified, size):
self.full_path = "/" + full_path
self.date_modified = self.get_format_date(date_modified)
Expand Down Expand Up @@ -128,7 +128,8 @@ def get_human_readable_size(self, suffix='B'):
num /= 1024.0
return "%.1f%s%s" % (num, 'Yi', suffix)

def get_format_date(self, date):
@staticmethod
def get_format_date(date):
# 2017-12-11 11:56:04
if date:
return datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
Expand Down
5 changes: 3 additions & 2 deletions src/providers/azure_provider.py
Expand Up @@ -38,8 +38,9 @@ def check(self):

def get_download_url(self, relative_path):
return self.url.rstrip("/") + "/" + relative_path

def _parse_line(self, line):

@staticmethod
def _parse_line(line):
# INFO: filename; Content Length: 1234
line_parsed = AZURE_LINE_REGEX.findall(line)
if line_parsed:
Expand Down
10 changes: 6 additions & 4 deletions src/providers/base_provider.py
Expand Up @@ -9,11 +9,13 @@ def __init__(self, url):
@staticmethod
def is_provider(url):
return False

def check(self):

@staticmethod
def check():
return True

def get_download_url(self, relative_path):

@staticmethod
def get_download_url(relative_path):
return relative_path

def hostname(self):
Expand Down
3 changes: 2 additions & 1 deletion src/s3viewer.py
Expand Up @@ -317,7 +317,8 @@ def get_tree_item_full_path(self, item):
return out

# Node to tree item
def create_tree_view_item(self, node, tree_parent):
@staticmethod
def create_tree_view_item(node, tree_parent):
# Create tree item
tree_item = QTreeWidgetItem(tree_parent, [node.basename, str(node.get_human_readable_size()), node.get_date_modified(), ""])
# Set icon
Expand Down