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

Moderinze migrate to python3 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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
5 changes: 1 addition & 4 deletions ncdu_s3/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from __future__ import absolute_import
import click
import itertools
import urlparse
from ncdu_s3 import NcduDataWriter, DirectoryWalker, S3DirectoryGenerator


Expand All @@ -14,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