Skip to content

Commit

Permalink
2to3: Migrate to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatczuk committed Jan 5, 2021
1 parent 8937cca commit e9b2f01
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
2 changes: 0 additions & 2 deletions ncdu_s3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from .ncdu_data_writer import NcduDataWriter
from .directory_walker import DirectoryWalker
from .s3_directory_generator import S3DirectoryGenerator
4 changes: 1 addition & 3 deletions ncdu_s3/directory_walker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import itertools


Expand All @@ -20,7 +18,7 @@ def process_item(self, path, size):
conflict = False
add_dirs = []

for p1, p2 in itertools.izip_longest(self.current_path, path):
for p1, p2 in itertools.zip_longest(self.current_path, path):
if p1 != p2:
# first conflict starts another logic in our code
conflict = True
Expand Down
3 changes: 1 addition & 2 deletions ncdu_s3/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
import click
from ncdu_s3 import NcduDataWriter, DirectoryWalker, S3DirectoryGenerator

Expand All @@ -12,7 +11,7 @@ def main(ctx, s3_url, output):

try:
s3_directory_generator = S3DirectoryGenerator(s3_url)
except SyntaxError, e:
except SyntaxError as e:
ctx.fail(e.message)
return

Expand Down
4 changes: 1 addition & 3 deletions ncdu_s3/ncdu_data_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import time
import ujson as json

Expand Down Expand Up @@ -62,7 +60,7 @@ def file_entry(self, name, size):
json.dump({'name': name, 'dsize': size}, self.output)

def close(self):
for i in xrange(self.depth):
for i in range(self.depth):
self.dir_leave()

# close the format JSON document we opened in our constructor
Expand Down
6 changes: 2 additions & 4 deletions ncdu_s3/s3_directory_generator.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from __future__ import absolute_import

import urlparse
from urllib.parse import urlparse
import boto3

class S3DirectoryGenerator(object):
def __init__(self, s3_url):
parsed_s3_url = urlparse.urlparse(s3_url)
parsed_s3_url = urlparse(s3_url)
if parsed_s3_url.scheme != 's3':
raise SyntaxError('Invalid S3 scheme')

Expand Down

0 comments on commit e9b2f01

Please sign in to comment.