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

PEP8 fixes on codebase #309

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ef39bac
Bump version to 0.16
cstavr Nov 11, 2014
796c732
PEP8 fixes on ci directory
vgerak Nov 12, 2014
be2e9ed
PEP8 fixes on contrib/snf-pithos-tools directory
vgerak Nov 12, 2014
c2c090e
PEP8 fixes on contrib directory
vgerak Nov 12, 2014
4a0c07e
PEP8 fixes on conf directory
vgerak Nov 12, 2014
ac01bdb
PEP8 fixes on snf-admin-app directory
vgerak Nov 12, 2014
fa80446
PEP8 fixes on snf-astakos-app/astakos/im/migrations directory
vgerak Nov 12, 2014
161d6ac
PEP8 fixes on snf-astakos-app/astakos/admin directory
vgerak Nov 12, 2014
c7a2b07
PEP8 fixes on snf-astakos-app/astakos/api directory
vgerak Nov 12, 2014
0cce468
PEP8 fixes on snf-astakos-app/astakos/im directory
vgerak Nov 12, 2014
e4cd1ae
PEP8 fixes on snf-astakos-app/astakos/oa2 directory
vgerak Nov 12, 2014
0c2ddb1
PEP8 fixes on snf-astakos-app/astakos/quotaholder_app directory
vgerak Nov 12, 2014
5d61b92
PEP8 fixes on snf-astakos-app/astakos directory
vgerak Nov 12, 2014
cbbc3da
PEP8 fixes on snf-branding directory
vgerak Nov 12, 2014
194284e
PEP8 fixes on snf-common directory
vgerak Nov 12, 2014
5cbf36c
PEP8 fixes on snf-cyclades-app/synnefo/admin directory
vgerak Nov 12, 2014
ffc2a65
PEP8 fixes on snf-cyclades-app/synnefo/api directory
vgerak Nov 12, 2014
cab279c
PEP8 fixes on snf-cyclades-app/synnefo/app_settings directory
vgerak Nov 12, 2014
c14ec94
PEP8 fixes on snf-cyclades-app/synnefo/db directory
vgerak Nov 12, 2014
e3c21dd
PEP8 fixes on snf-cyclades-app/synnefo/helpdesk directory
vgerak Nov 12, 2014
669c733
PEP8 fixes on snf-cyclades-app/synnefo/logic directory
vgerak Nov 12, 2014
7acaf0f
PEP8 fixes on snf-cyclades-app/synnefo/quotas directory
vgerak Nov 12, 2014
b4f3a45
PEP8 fixes on snf-cyclades-app/synnefo/ui directory
vgerak Nov 12, 2014
05078ef
PEP8 fixes on snf-cyclades-app/synnefo/userdata directory
vgerak Nov 12, 2014
5e8f67b
PEP8 fixes on snf-cyclades-app/synnefo/vmapi directory
vgerak Nov 12, 2014
161fd86
PEP8 fixes on snf-cyclades-app/synnefo/volume directory
vgerak Nov 12, 2014
d0c62a4
PEP8 fixes on snf-cyclades-app directory
vgerak Nov 12, 2014
5d4362f
PEP8 fixes on snf-cyclades-gtools directory
vgerak Nov 12, 2014
b3ae78b
PEP8 fixes on snf-deploy directory
vgerak Nov 12, 2014
1ffbe14
PEP8 fixes on snf-django-lib directory
vgerak Nov 12, 2014
59e75f8
PEP8 fixes on snf-pithos-app directory
vgerak Nov 12, 2014
6f08585
PEP8 fixes on snf-pithos-backend directory
vgerak Nov 12, 2014
f67b510
PEP8 fixes on snf-stats-app directory
vgerak Nov 12, 2014
1416a61
PEP8 fixes on snf-tools directory
vgerak Nov 12, 2014
94441f8
PEP8 fixes on snf-webproject directory
vgerak Nov 12, 2014
eba1915
Convert type comparison to isinstance() and fix mistake in test
vgerak Nov 12, 2014
7e6c9af
Convert "condition == False" to "not(condition)"
vgerak Nov 12, 2014
d146733
Fix pythonic expressions in snf-astakos-app/astakos/im directory
vgerak Nov 12, 2014
9948c9b
Fix pythonic expressions in snf-astakos-app/astakos/oa2/tests/simple.py
vgerak Nov 12, 2014
89e9e4a
Fix pythonic expressions in snf-common/synnefo/util/entry_points.py
vgerak Nov 12, 2014
f23389e
Fix pythonic expressions in snf-cyclades-app/synnefo directory
vgerak Nov 12, 2014
18554c4
Fix pythonic expressions in snf-django-lib directory
vgerak Nov 12, 2014
4d3f155
Fix pythonic expressions in snf-pithos-backend directory
vgerak Nov 12, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion ci/pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def filter_files(files):
# Check if file is a python file
if not f.endswith(".py"):
continue
#Check if file is to be excluded
# Check if file is to be excluded
if os.path.basename(f) in EXCLUDE:
continue
# Check if file existsw
Expand Down
2 changes: 1 addition & 1 deletion contrib/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Migration(object):
def __init__(self, db):
self.engine = create_engine(db)
self.metadata = MetaData(self.engine)
#self.engine.echo = True
# self.engine.echo = True
self.conn = self.engine.connect()

options = getattr(settings, 'BACKEND', None)[1]
Expand Down
6 changes: 3 additions & 3 deletions contrib/snf-pithos-tools/pithos/tools/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ def main():
level=logging.DEBUG if DEBUG else logging.INFO)
logger = logging.getLogger('dispatcher')

host = 'amqp://%s:%s@%s:%s' % (opts.user, opts.password, opts.host, opts.port)
host = 'amqp://%s:%s@%s:%s' % (opts.user, opts.password, opts.host, opts.port)
queue = opts.queue
key = opts.key
exchange = opts.exchange

client = AMQPClient(hosts=[host])
client.connect()

Expand All @@ -89,7 +89,7 @@ def main():
type='topic')
client.basic_publish(exchange=exchange,
routing_key=key,
body= json.dumps({"test": "0123456789"}))
body=json.dumps({"test": "0123456789"}))
client.close()
sys.exit()

Expand Down
18 changes: 9 additions & 9 deletions contrib/snf-pithos-tools/pithos/tools/lib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ def _req(self, method, path, body=None, headers=None, format='text',
kwargs['headers'].setdefault('content-length', len(body)
if body else 0)

#print '#', method, full_path, kwargs
#t1 = datetime.datetime.utcnow()
# print '#', method, full_path, kwargs
# t1 = datetime.datetime.utcnow()
conn.request(method, full_path, **kwargs)

resp = conn.getresponse()
#t2 = datetime.datetime.utcnow()
#print 'response time:', str(t2-t1)
# t2 = datetime.datetime.utcnow()
# print 'response time:', str(t2-t1)
return _handle_response(resp, self.verbose, self.debug)

def _chunked_transfer(self, path, method='PUT', f=stdin, headers=None,
Expand Down Expand Up @@ -129,13 +129,13 @@ def _chunked_transfer(self, path, method='PUT', f=stdin, headers=None,
try:
conn.send(data)
except:
#retry
# retry
conn.send(data)
data = '0\r\n\r\n'
try:
conn.send(data)
except:
#retry
# retry
conn.send(data)

resp = conn.getresponse()
Expand Down Expand Up @@ -294,7 +294,7 @@ def list_objects(self, container, format='text',
'delimiter': delimiter, 'path': path})
l = self._list('/%s/%s' % (account, container), format, params,
**headers)
#TODO support filter trashed with xml also
# TODO support filter trashed with xml also
if format != 'xml' and not include_trashed:
l = self._filter_trashed(l)
return l
Expand Down Expand Up @@ -995,7 +995,7 @@ def move_object(self, src_container, src_object, dst_container,
**headers)

def list_shared_with_me(self, limit=None, marker=None, format='text',
translate=None):
translate=None):
"""lists other accounts that share objects to the user"""
l = ['limit', 'marker']
params = {}
Expand Down Expand Up @@ -1050,5 +1050,5 @@ def _handle_response(response, verbose=False, debug=False):
if int(response.status) in ERROR_CODES.keys():
raise Fault(data, int(response.status))

#print '**', response.status, headers, data, '\n'
# print '**', response.status, headers, data, '\n'
return response.status, headers, data
14 changes: 6 additions & 8 deletions contrib/snf-pithos-tools/pithos/tools/lib/fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,8 @@ class fuse_operations(Structure):
('open', CFUNCTYPE(c_int, c_char_p, POINTER(fuse_file_info))),
('read', CFUNCTYPE(c_int, c_char_p, POINTER(c_byte), c_size_t, c_off_t,
POINTER(fuse_file_info))),
(
'write', CFUNCTYPE(c_int, c_char_p, POINTER(c_byte), c_size_t, c_off_t,
POINTER(fuse_file_info))),
('write', CFUNCTYPE(c_int, c_char_p, POINTER(c_byte), c_size_t, c_off_t,
POINTER(fuse_file_info))),
('statfs', CFUNCTYPE(c_int, c_char_p, POINTER(c_statvfs))),
('flush', CFUNCTYPE(c_int, c_char_p, POINTER(fuse_file_info))),
('release', CFUNCTYPE(c_int, c_char_p, POINTER(fuse_file_info))),
Expand All @@ -222,10 +221,9 @@ class fuse_operations(Structure):
('listxattr', CFUNCTYPE(c_int, c_char_p, POINTER(c_byte), c_size_t)),
('removexattr', CFUNCTYPE(c_int, c_char_p, c_char_p)),
('opendir', CFUNCTYPE(c_int, c_char_p, POINTER(fuse_file_info))),
(
'readdir', CFUNCTYPE(c_int, c_char_p, c_voidp, CFUNCTYPE(c_int, c_voidp,
c_char_p, POINTER(
c_stat), c_off_t), c_off_t, POINTER(fuse_file_info))),
('readdir', CFUNCTYPE(c_int, c_char_p, c_voidp, CFUNCTYPE(c_int, c_voidp,
c_char_p, POINTER(c_stat), c_off_t), c_off_t,
POINTER(fuse_file_info))),
('releasedir', CFUNCTYPE(c_int, c_char_p, POINTER(fuse_file_info))),
('fsyncdir', CFUNCTYPE(c_int, c_char_p, c_int, POINTER(
fuse_file_info))),
Expand Down Expand Up @@ -298,7 +296,7 @@ class as is to Operations, instead of just the fh field.
args.append('-s')
kwargs.setdefault('fsname', operations.__class__.__name__)
args.append('-o')
args.append(','.join(key if val == True else '%s=%s' % (key, val)
args.append(','.join(key if val else '%s=%s' % (key, val)
for key, val in kwargs.items()))
args.append(mountpoint)
argv = (c_char_p * len(args))(*args)
Expand Down
21 changes: 11 additions & 10 deletions contrib/snf-pithos-tools/pithos/tools/sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

_cli_commands = {}


def cli_command(*args):
def decorator(cls):
cls.commands = args
Expand Down Expand Up @@ -163,7 +164,7 @@ def list_containers(self):
print_list(l)

def list_objects(self, container):
#prepate params
# prepate params
params = {}
attrs = ['limit', 'marker', 'prefix', 'delimiter', 'path',
'meta', 'if_modified_since', 'if_unmodified_since',
Expand All @@ -180,7 +181,7 @@ def list_objects(self, container):
return

detail = 'json'
#if request with meta quering disable trash filtering
# if request with meta quering disable trash filtering
show_trashed = True if self.meta else False
l = self.client.list_objects(container, **args)
print_list(l, detail=self.detail)
Expand Down Expand Up @@ -395,7 +396,7 @@ def add_options(self, parser):
parser.add_option('--content-disposition', action='store', type='str',
dest='content_disposition', default=None,
help='provide the presentation style of the object')
#parser.add_option('-S', action='store',
# parser.add_option('-S', action='store',
# dest='segment_size', default=False,
# help='use for large file support')
parser.add_option('--manifest', action='store',
Expand All @@ -418,7 +419,7 @@ def execute(self, path, *args):
if path.find('=') != -1:
raise Fault('Missing path argument')

#prepare user defined meta
# prepare user defined meta
meta = {}
for arg in args:
key, sep, val = arg.partition('=')
Expand Down Expand Up @@ -483,7 +484,7 @@ def execute(self, src, dst, *args):
src_container, sep, src_object = src.partition('/')
dst_container, sep, dst_object = dst.partition('/')

#prepare user defined meta
# prepare user defined meta
meta = {}
for arg in args:
key, sep, val = arg.partition('=')
Expand All @@ -509,7 +510,7 @@ class SetMeta(Command):
description = 'set account/container/object metadata'

def execute(self, path, *args):
#in case of account fix the args
# in case of account fix the args
if path.find('=') != -1:
args = list(args)
args.append(path)
Expand Down Expand Up @@ -572,7 +573,7 @@ def execute(self, path, *args):
if path.find('=') != -1:
raise Fault('Missing path argument')

#prepare user defined meta
# prepare user defined meta
meta = {}
for arg in args:
key, sep, val = arg.partition('=')
Expand Down Expand Up @@ -627,7 +628,7 @@ def execute(self, src, dst, *args):
dst_container = src_container
dst_object = dst

#prepare user defined meta
# prepare user defined meta
meta = {}
for arg in args:
key, sep, val = arg.partition('=')
Expand All @@ -648,7 +649,7 @@ class UnsetObject(Command):
description = 'delete metadata info'

def execute(self, path, *args):
#in case of account fix the args
# in case of account fix the args
if len(args) == 0:
args = list(args)
args.append(path)
Expand Down Expand Up @@ -805,7 +806,7 @@ def print_dict(d, header='name', f=stdout, detail=True):

def print_list(l, verbose=False, f=stdout, detail=True):
for elem in l:
#if it's empty string continue
# if it's empty string continue
if not elem:
continue
if isinstance(elem, types.DictionaryType):
Expand Down
Loading