Skip to content

Commit

Permalink
[linting]
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed Dec 20, 2016
1 parent de8afa3 commit a519fba
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions graphenebase/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
operations["asset_claim_fees"] = 43


def getOperationNameForId(i) :
def getOperationNameForId(i):
""" Convert an operation id into the corresponding string
"""
for key in operations :
if int(operations[key]) is int(i) :
for key in operations:
if int(operations[key]) is int(i):
return key
return "Unknown Operation ID %d" % i


class Operation() :
def __init__(self, op) :
class Operation():
def __init__(self, op):
if isinstance(op, list) and len(op) == 2:
if isinstance(op[0], int):
self.opId = op[0]
Expand All @@ -87,18 +87,18 @@ def __init__(self, op) :
def operations(self):
return operations

def getOperationNameForId(self, i) :
def getOperationNameForId(self, i):
return getOperationNameForId(i)

def _getklass(self, name):
module = __import__("graphenebase.operations", fromlist=["operations"])
class_ = getattr(module, name)
return class_

def __bytes__(self) :
def __bytes__(self):
return bytes(Id(self.opId)) + bytes(self.op)

def __str__(self) :
def __str__(self):
return json.dumps([self.opId, self.op.toJson()])


Expand All @@ -107,8 +107,8 @@ def __str__(self) :
"""


class Transfer(GrapheneObject) :
def __init__(self, *args, **kwargs) :
class Transfer(GrapheneObject):
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -119,17 +119,17 @@ def __init__(self, *args, **kwargs) :
else:
memo = Optional(None)
super().__init__(OrderedDict([
('fee' , Asset(kwargs["fee"])),
('from' , ObjectId(kwargs["from"], "account")),
('to' , ObjectId(kwargs["to"], "account")),
('amount' , Asset(kwargs["amount"])),
('memo' , memo),
('fee', Asset(kwargs["fee"])),
('from', ObjectId(kwargs["from"], "account")),
('to', ObjectId(kwargs["to"], "account")),
('amount', Asset(kwargs["amount"])),
('memo', memo),
('extensions', Set([])),
]))


class Asset_publish_feed(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -145,7 +145,7 @@ def __init__(self, *args, **kwargs) :


class Asset_update(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -166,7 +166,7 @@ def __init__(self, *args, **kwargs) :


class Op_wrapper(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -178,7 +178,7 @@ def __init__(self, *args, **kwargs) :


class Proposal_create(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -200,7 +200,7 @@ def __init__(self, *args, **kwargs) :


class Proposal_update(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -217,9 +217,9 @@ def __init__(self, *args, **kwargs) :
kwargs[o] = []

super().__init__(OrderedDict([
('fee' , Asset(kwargs["fee"])),
('fee_paying_account', ObjectId(kwargs["fee_paying_account"], "account")),
('proposal', ObjectId(kwargs["proposal"], "proposal")),
('fee', Asset(kwargs["fee"])),
('fee_paying_account', ObjectId(kwargs["fee_paying_account"], "account")),
('proposal', ObjectId(kwargs["proposal"], "proposal")),
('active_approvals_to_add',
Array([ObjectId(o, "account") for o in kwargs["active_approvals_to_add"]])),
('active_approvals_to_remove',
Expand All @@ -232,12 +232,12 @@ def __init__(self, *args, **kwargs) :
Array([PublicKey(o) for o in kwargs["key_approvals_to_add"]])),
('key_approvals_to_remove',
Array([PublicKey(o) for o in kwargs["key_approvals_to_remove"]])),
('extensions', Set([])),
('extensions', Set([])),
]))


class Limit_order_create(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -255,7 +255,7 @@ def __init__(self, *args, **kwargs) :


class Limit_order_cancel(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -270,7 +270,7 @@ def __init__(self, *args, **kwargs) :


class Call_order_update(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -286,7 +286,7 @@ def __init__(self, *args, **kwargs) :


class Asset_fund_fee_pool(GrapheneObject):
def __init__(self, *args, **kwargs) :
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -301,8 +301,8 @@ def __init__(self, *args, **kwargs) :
]))


class Override_transfer(GrapheneObject) :
def __init__(self, *args, **kwargs) :
class Override_transfer(GrapheneObject):
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
else:
Expand All @@ -313,18 +313,18 @@ def __init__(self, *args, **kwargs) :
else:
memo = Optional(None)
super().__init__(OrderedDict([
('fee' , Asset(kwargs["fee"])),
('issuer' , ObjectId(kwargs["issuer"], "account")),
('from' , ObjectId(kwargs["from"], "account")),
('to' , ObjectId(kwargs["to"], "account")),
('amount' , Asset(kwargs["amount"])),
('memo' , memo),
('fee', Asset(kwargs["fee"])),
('issuer', ObjectId(kwargs["issuer"], "account")),
('from', ObjectId(kwargs["from"], "account")),
('to', ObjectId(kwargs["to"], "account")),
('amount', Asset(kwargs["amount"])),
('memo', memo),
('extensions', Set([])),
]))


class Account_create(GrapheneObject) :
def __init__(self, *args, **kwargs) :
class Account_create(GrapheneObject):
def __init__(self, *args, **kwargs):
# Allow for overwrite of prefix
prefix = kwargs.pop("prefix", default_prefix)

Expand All @@ -334,13 +334,13 @@ def __init__(self, *args, **kwargs) :
if len(args) == 1 and len(kwargs) == 0:
kwargs = args[0]
super().__init__(OrderedDict([
('fee' , Asset(kwargs["fee"])),
('registrar' , ObjectId(kwargs["registrar"], "account")),
('referrer' , ObjectId(kwargs["referrer"], "account")),
('referrer_percent' , Uint16(kwargs["referrer_percent"])),
('name' , String(kwargs["name"])),
('owner' , Permission(kwargs["owner"], prefix=prefix)),
('active' , Permission(kwargs["active"], prefix=prefix)),
('options' , AccountOptions(kwargs["options"], prefix=prefix)),
('extensions' , Set([])),
('fee', Asset(kwargs["fee"])),
('registrar', ObjectId(kwargs["registrar"], "account")),
('referrer', ObjectId(kwargs["referrer"], "account")),
('referrer_percent', Uint16(kwargs["referrer_percent"])),
('name', String(kwargs["name"])),
('owner', Permission(kwargs["owner"], prefix=prefix)),
('active', Permission(kwargs["active"], prefix=prefix)),
('options', AccountOptions(kwargs["options"], prefix=prefix)),
('extensions', Set([])),
]))

0 comments on commit a519fba

Please sign in to comment.